1.0.16 • Published 6 years ago

osdynamo v1.0.16

Weekly downloads
2
License
ISC
Repository
-
Last release
6 years ago

OSDynamo

OSDynamo is a tiny ORM typescript component made to facilitate Dynamo database handling

Install

yarn add osdynamo --save

Usage

Just declare your table with our decorators

import { OSDynamo, partitionKey, table } from 'osdynamo'

@table('CategoriesTable')
export class CategoryTable {

    @partitionKey() 
    public id: string

    public name: string

    public imageURL: string
}

...and then call the define method to get a reference to your model so you can save and retrieve data from Dynamo like this

const Category = OSDynamo.defineTable(CategoryTable)

Category.get({id: 'some id'}) // gets one category

Category.batchGet([ // gets multiple categories
    { id: 'some id' }, { id: 'another id' }, { id :'and so on...' }
])

Category.scan() // gets all categories from the table

Category.put({ id: '123', name: 'Fake category', imageURL: 'http://fakeimage.com'}) // writes a new item

Category.update({name: 'another fake name'}, {id: '123'})

Category.delete({id: '123'})

Current supported methods are:

  • get

  • batchGet (if it reaches Dynamo batchGet limit, this method splits into multiple parallel requests so you don't have to worry)

  • scan

  • put

  • batchWrite (if it reaches Dynamo batchWrite limit, this method splits into multiple parallel requests so you don't have to worry)

  • delete

  • query

IMPORTANT: dynamo region must be specified at node enviroment

More examples are coming!

CLI is coming

  • Commands like create and update table will we available soon

Want to contribute?

  • Whenever you face a bug or an uncovered use case, fix it in this same repository, so it can be published and used by other people :)
1.0.16

6 years ago

1.0.15

6 years ago

1.0.14

6 years ago

1.0.13

6 years ago

1.0.12

6 years ago

1.0.11

6 years ago

1.0.10

6 years ago

1.0.9

6 years ago

1.0.8

6 years ago

1.0.7

6 years ago

1.0.6

6 years ago

1.0.5

6 years ago

1.0.4

7 years ago

1.0.3

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago