noppoMan / npdynamodb

A Node.js Simple Query Builder and ORM for AWS DynamoDB
112 stars 18 forks source link

Schema and Type declaration support for ORM #36

Open noppoMan opened 9 years ago

noppoMan commented 9 years ago

This is new function for building more typesafe app with npdynamodb.ORM. Here is desired syntax.

var Chat = npdynamodb.define('chats', {
  npdynamodb: npd,

  schema: new Schema(function(s){
    s.string("id").hashKey();
    s.number("timestamp").rangeKey().default(s.fn.NOW);
    s.string("message");
    s.map("user", [s.String, s.Any]);
  })
});