0.0
Repository is archived
No commit activity in last 3 years
No release in over 3 years
An ActiveRecord like ODM for AWS DynamoDB
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

>= 0

Runtime

 Project Readme

active-dynamo

An ActiveRecord like ODM for AWS DynamoDB

Gem Version

Installation

gem install active-dynamo

Usage

Currently, the supported operations are as follows:

  • Define a model in a way similar to ActiveRecord, calling table_name and attributes functions:
class Account < ActiveDynamo::Base
  table name: 'account', partition_key: :no, sort_key: :balance
  attributes no: Integer, balance: Integer, kind: String
end
  • Create a new record:
account = Account.new(no: 123, balance: 2000, kind: 'current')
account.save

# or use `create`
account = Account.create(no: 123, balance: 2000, kind: 'current')
  • Query the table using methods such as:
Account.all

Account.where(no: 123, balance: 2000)
Account.where("no = 123 and balance >= 2000 and kind = 'current'")

Account.find(no: 123, balance: 2000)
  • Update a record
account = Account.first
account.update(kind: 'savings')
  • Delete a record
Account.destroy(no: 123, balance: 2000)

License

See LICENSE.