Giter VIP home page Giter VIP logo

clean_dynamodb_store's Introduction

AWS Clean DynamoDB Store

clean_dynamodb_store is a Rust library designed to follow clean architecture principles, offering a straightforward and efficient DynamoDB store implementation. It simplifies interactions with AWS DynamoDB, making it easier to perform common database operations such as inserting and deleting items in a DynamoDB table.

Features

  • Easy-to-use asynchronous API for DynamoDB.
  • Supports basic DynamoDB operations like put (insert/update) and delete items.
  • Built on top of aws-sdk-dynamodb for robust and up-to-date DynamoDB access.
  • Designed with clean architecture principles in mind.

Prerequisites

Before you begin, ensure you have met the following requirements:

  • Rust 2021 edition or later.
  • AWS account and configured AWS CLI or environment variables for AWS access.

Installation

Add clean_dynamodb_store to your Cargo.toml:

[dependencies]
clean_dynamodb_store = "0.0.2"

Usage

Putting an Item into a DynamoDB Table

use clean_dynamodb_store::put_item;
use aws_sdk_dynamodb::types::AttributeValue;
use std::collections::HashMap;

#[tokio::main]
async fn main() -> Result<(), aws_sdk_dynamodb::Error> {
    let table_name = "your_table_name";
    let mut item = HashMap::new();
    item.insert("id".to_string(), AttributeValue::S("example_id".to_string()));
    item.insert("content".to_string(), AttributeValue::S("Hello, world!".to_string()));

    put_item(table_name, item).await?;
    Ok(())
}

Deleting an Item from a DynamoDB Table

use clean_dynamodb_store::delete_item;
use aws_sdk_dynamodb::types::AttributeValue;
use std::collections::HashMap;

#[tokio::main]
async fn main() -> Result<(), aws_sdk_dynamodb::Error> {
    let table_name = "your_table_name";
    let mut key = HashMap::new();
    key.insert("id".to_string(), AttributeValue::S("example_id".to_string()));

    delete_item(table_name, key).await?;
    Ok(())
}

License

Distributed under the MIT License. See LICENSE for more information.

Contact

Ivan Videnovic - [email protected]

clean_dynamodb_store's People

Contributors

vvivan avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.