Git Product home page Git Product logo

aws-sdk-ruby-record's Introduction

Aws::Record

Build Status Code Climate Coverage Status

A data mapping abstraction over the AWS SDK for Ruby's client for Amazon DynamoDB.

This library is currently under development. More features will be added as we approach general availability, and while our initial release has as small of an API surface area as possible, the interface may change before the GA release.

We would like to invite you to be a part of the ongoing development of this gem. We welcome your contributions, and would also be happy to hear from you about how you would like to use this gem. Feature requests are welcome.

Links of Interest

Installation

Aws::Record is available as the aws-record gem from RubyGems.

gem install 'aws-record'
gem 'aws-record', '~> 2.0'

This automatically includes a dependency on the aws-sdk-dynamodb gem (part of the modular version-3 of the AWS SDK for Ruby. If you need to pin to a specific version, you can add aws-sdk-dynamodb or aws-sdk-core gem in your Gemfile.

Usage

To create a model that uses aws-record features, simply include the provided module:

class MyModel
  include Aws::Record
end

You can then specify attributes using the aws-record DSL:

class MyModel
  include Aws::Record
  integer_attr :id, hash_key: true
  string_attr  :name, range_key: true
  boolean_attr :active, database_attribute_name: "is_active_flag"
end

If a matching table does not exist in DynamoDB, you can use the TableConfig DSL to create your table:

cfg = Aws::Record::TableConfig.define do |t|
  t.model_class(MyModel)
  t.read_capacity_units(5)
  t.write_capacity_units(2)
end
cfg.migrate!

With a table in place, you can then use your model class to manipulate items in your table:

item = MyModel.find(id: 1, name: "Hello Record")
item.active = true
item.save
item.delete!

MyModel.find(id: 1, name: "Hello Record") # => nil

item = MyModel.new
item.id = 2
item.name = "Item"
item.active = false
item.save

aws-sdk-ruby-record's People

Contributors

adomokos avatar alboyadjian avatar alextwoods avatar arjes avatar awood45 avatar bdnelson avatar cjyclaire avatar clowder avatar derigible avatar hyandell avatar michaelglass avatar mullermp avatar natesalisbury avatar pye2k avatar trevorrowe avatar yankeenjg avatar yashosharma avatar

Stargazers

 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.