crynamo

Simple DynamoDB client dynamodb database aws object-oriented
HEAD Latest release released
timkendall/crynamo
14 4 11
Tim Kendall

Crynamo

Build Status GitHub release

Crynamo is a simple interface to Amazon's DynamoDB written in Crystal. Right now it is a fairly low-level wrapper that provides type marshalling between your Crystal program and DynamoDB.

  • ✔️ Simple API with get, put, and delete support
  • ✔️ DynamoDB type marshalling
  • ✔️ Native exceptions for every AWS error
  • ✔️ Non-blocking

Installation

Add this to your application's shard.yml:

dependencies:
  crynamo:
    github: timkendall/crynamo
    version: ~> 0.1.1

Usage

  1. Configuration
  2. Client

Configuration

require "crynamo"

config = Crynamo::Configuration.new(
  access_key_id: "aws-access-key",
  secret_access_key: "aws-secret-key",
  region: "us-east-1",
  endpoint: "http://localhost:8000",
)
dynamodb = Crynamo::Client.new(config)

Client

Crynamo exposes Crynamo::Client as a basic DynamoDB client. The client's API is low-level and mimics the base DynamoDB Low-Level HTTP API.

# Get an item
dynamodb.get!("pets", { name: "Doobie" })

# Insert an item
dynamodb.put!("pets", { name: "Thor", lifespan: 100 })

# Remove an item
dynamodb.delete!("pets", { name: "Doobie" })

Development

  1. Follow the instructions here to setup Local DynamoDB
  2. Install Crystal deps with shards install
  3. Use icr to play with things

Tip

It's useful to define a bash command for launching DynamoDB. Add this to your .bash_profile to start DynamoDB with a simple dynamodb command.

dynamodb() {
 cd /path/to/dynamodb
 java -Djava.library.path=./DynamoDBLocal_lib -jar DynamoDBLocal.jar -sharedDb
}

Contributing

  1. Fork it ( https://github.com/[your-github-name]/crynamo/fork )
  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 a new Pull Request

Contributors

crynamo:
  github: timkendall/crynamo
  
License MIT
Crystal 0.24.1

Authors

  • <timkendall18@gmail.com>

Dependencies 1

  • awscr-signer ~> 0.4.0
    {'github' => 'taylorfinnell/awscr-signer', 'version' => '~> 0.4.0'}

Development Dependencies 1

  • webmock ~> 0.9.3
    {'github' => 'manastech/webmock.cr', 'version' => '~> 0.9.3'}

Dependents 0

Last synced .
search fire star recently