crynamo
Crynamo
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
, anddelete
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
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
- Follow the instructions here to setup Local DynamoDB
- Install Crystal deps with
shards install
- 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
- Fork it ( https://github.com/[your-github-name]/crynamo/fork )
- Create your feature branch (git checkout -b my-new-feature)
- Commit your changes (git commit -am 'Add some feature')
- Push to the branch (git push origin my-new-feature)
- Create a new Pull Request
Contributors
- timkendall - creator, maintainer