3.2.0-beta.18 • Published 12 months ago

dynamoose-typescript v3.2.0-beta.18

Weekly downloads
-
License
MIT
Repository
-
Last release
12 months ago

Description

a decorator for dynamoose inspired by sequelize-typescript and @nestjs/mongoose.

Getting started

install using yarn

yarn add dynamoose-decorator dynamoose

or install using pnpm

pnpm add dynamoose-decorator dynamoose

Usage

import { randomUUID } from "crypto";
import {
  Attribute,
  CreatedAt,
  Model,
  UpdatedAt,
  getModel,
} from "dynamoose-typescript";
import { Item } from "dynamoose/dist/Item";

@Model()
export class ProductTable extends Item {
  @Attribute({
    hashKey: true,
  })
  id: string;

  @Attribute()
  name?: string;

  @Attribute()
  price?: number;

  @Attribute({
    required: true,
  })
  disable: boolean;

  @CreatedAt()
  createdAt: Date;

  @UpdatedAt()
  updatedAt: Date;
}

(async () => {
  const ProductTableModel = getModel(ProductTable);

  const product = await ProductTableModel.create({
    id: randomUUID(),
    name: "candy",
    price: 1000,
    disable: true,
  });

  product.disable = true;
  await product.save();
})();
3.2.0-beta.18

12 months ago

3.2.0

12 months ago

3.2.0-beta.17

12 months ago

3.2.0-beta.16

12 months ago

3.2.0-beta.15

12 months ago

3.2.0-beta.14

12 months ago

3.2.0-beta.13

12 months ago

3.2.0-beta.12

12 months ago

3.2.0-beta.11

12 months ago

3.2.0-beta.10

12 months ago

3.2.0-beta.9

12 months ago

3.2.0-beta.8

12 months ago

3.2.0-beta.7

12 months ago

3.2.0-beta.5

12 months ago

3.2.0-beta.4

12 months ago

3.2.0-beta.3

12 months ago

3.2.0-beta.2

12 months ago

3.2.0-beta.1

12 months ago