Code Monkey home page Code Monkey logo

dynomite's Introduction

🦀🧨

dynomite

dynomite makes DynamoDB fit your types (and visa versa)


Overview

Goals

  • ⚡ make writing dynamodb applications in rust a productive experience
  • 🦀 exploit rust's type safety features
  • 👩‍💻 leverage existing work of the rusoto rust project
  • ☔ commitment to supporting applications built using stable rust
  • 📚 commitment to documentation

Features

  • 💌 less boilerplate
  • ♻️ automatic async pagination
  • 🕶️ client level retry interfaces for robust error handling

From this

use std::collections::HashMap;
use rusoto_dynamodb::AttributeValue;
use uuid::Uuid;

let mut item = HashMap::new();
item.insert(
  "pk".to_string(), AttributeValue {
    s: Some(Uuid::new_v4().to_hyphenated().to_string()),
    ..AttributeValue::default()
  }
);
item.insert(
  // 🤬typos anyone?
  "quanity".to_string(), AttributeValue {
    n: Some("whoops".to_string()),
    ..AttributeValue::default()
  }
);

To this

use dynomite::Item;
use uuid::Uuid;

#[derive(Item)]
struct Order {
  #[dynomite(partition_key)]
  pk: Uuid,
  quantity: u16
}

let item = Order {
  pk: Uuid::new_v4(),
  quantity: 4
}.into();

Please see the API documentation for how to get started. Enjoy.

📦 Install

In your Cargo.toml file, add the following under the [dependencies] heading

dynomite = "0.10"

🤸 Examples

You can find some example application code under dynomite/examples

DynamoDB local

AWS provides a convenient way to host a local instance of DynamoDB for testing.

Here is a short example of how to get up a testing locally quickly with both dynomite as well as rusoto_dynamodb.

In one terminal spin up a Docker container for DynamoDB local listening on port 8000

$ docker run --rm -p 8000:8000 amazon/dynamodb-local

In another, run a rust binary with a client initialized like you see the the local.rs example

Resources

Doug Tangren (softprops) 2018-2020

dynomite's People

Contributors

arsenyyankovsky avatar auyer avatar cedric-h avatar cutsoy avatar durangatan avatar jaboatman avatar jeprojects avatar phrohdoh avatar simonvandel avatar softprops avatar stanislav-tkach avatar veetaha avatar vvilhonen avatar

Watchers

 avatar  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.