Skip to content

arunkasireddi/dynamodb-data-mapper-js

 
 

Repository files navigation

Amazon DynamoDB DataMapper For JavaScript

Apache 2 License

This repository hosts several packages that collectively make up an object to document mapper for JavaScript applications using Amazon DynamoDB.

Getting started

The @aws/dynamodb-data-mapperpackage provides a simple way to persist and load an application's domain objects to and from Amazon DynamoDB. When used together with the decorators provided by the @aws/dynamodb-data-mapper-annotations package, you can describe the relationship between a class and its representation in DynamoDB by adding a few decorators:

import {DataMapper} from '@aws/dynamodb-data-mapper';
import {
    attribute,
    hashKey,
    rangeKey,
    table,
} from '@aws/dynamodb-data-mapper-annotations';

@table('table_name')
class MyDomainClass {
    @hashKey()
    id: string;

    @rangeKey({defaultProvider: () => new Date()})
    createdAt: Date;

    @attribute()
    completed?: boolean;
}

// Now you can save instances of this item to DynamoDB
const myDomainObject = new MyDomainClass();
myDomainObject.id = 'id';
const mapper = new DataMapper()
mapper.put(myDomainObject);

Please refer to the individual packages for more detailed documentation.

Constituent packages

About

A schema-based data mapper for Amazon DynamoDB.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • TypeScript 99.9%
  • JavaScript 0.1%