Lotus::Model DynamoDB Adapter

An adapter is a concrete implementation of persistence logic for a specific database.

-- jodosha, Lotus::Model

This adapter implements persistence layer for a Amazon DynamoDB, and it pretends to be a really sane solution to fully experience DynamoDB advantages with Ruby.

It is built using AWS::DynamoDB::Client, which is a part of aws-sdk gem and implements latest version of DynamoDB protocol.

Status

Gem Version Build Status Coverage Status Code Climate Inline docs Dependencies

Installation

Add this line to your application's Gemfile:

gem 'lotus-dynamodb'

And then execute:

$ bundle

Or install it yourself as:

$ gem install lotus-dynamodb

Usage

Please refer to Lotus::Model docs for any details related to Entity, Repository, Data Mapper and Adapter.

Data types

This adapter supports coercion to all DynamoDB types, including blobs and sets.

List of Ruby types that are supported:

  • AWS::DynamoDB::Binary – B
  • Array – S (via MultiJson)
  • Boolean – N (1 for true and 0 for false)
  • Date – N (Integer, seconds since Epoch)
  • DateTime – N (Float, seconds since Epoch)
  • Float – N
  • Hash – S (via MultiJson)
  • Integer – N
  • Set – SS, NS, BS (Set of String, Number or AWS::DynamoDB::Binary)
  • String – S
  • Time – N (Float, seconds since Epoch)

Repository methods

See complete list of Repository methods provided by Lotus::Model.

Following methods are not supported since it's incompatible with DynamoDB:

  • first
  • last

Query methods

Generic methods supported by DynamoDB adapter:

DynamoDB-specific methods:

Example

Check out the simple example in examples/purchase.rb.

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request