You're Invited: Meet the Socket team at BSidesSF and RSAC - April 27 - May 1.RSVP
Socket
Sign inDemoInstall
Socket

dynamo1

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dynamo1

Dynamo DB one table ORM for Javascript(& Typescript).

0.6.0
latest
Source
npm
Version published
Weekly downloads
1
-90%
Maintainers
1
Weekly downloads
 
Created
Source

Dynamo1

Build Downloads Version License Typescript
dependencies Status devDependencies Status

With Dynamo DB, only one table is enough.

Dynamo DB one table ORM for Javascript(& Typescript).

Installation

Usage


const connection = createConnection([
  {
    tableName: `${STAGE}-datas`,
    aliasName: 'datas',
    hashKey: { name: string, type: Buffer },
    rangeKey: { name: string, type: String },
    gsi: [
      { name: 'gsi1', hashKey: { name: string, type: String }, rangeKey: { name: string, type: String } },
      { name: 'gsi2', hashKey: { name: string, type: String }, rangeKey: { name: string, type: String } },
      { name: 'gsi3', hashKey: { name: string, type: String }, rangeKey: { name: string, type: String } },
    ],
  }, // tables[0] is default
])

Entity

import { v4 as uuid } from 'uuid'

import { Column, Entity, column, text } from 'dynamo1'

@Entity<User>({
  name: 'users',
  hashKey: text('users'),
  rangeKey: column('id'),
})
export class User {
  @Column({ name: 'user_id', onCreate: _ => uuid() })
  public id!: string

  @Column()
  public username?: string

  @Column()
  public email!: string

  @Column<User>({
    onCreate: entity => entity.createdAt || new Date().getTime(),
  })
  public createdAt!: number

  @Column<User>({
    onCreate: _ => new Date().getTime(),
    onUpdate: _ => new Date().getTime(),
  })
  public updatedAt!: number
}

Todo

Keywords

dynamodb

FAQs

Package last updated on 04 Nov 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts