2.0.0-alpha.4 • Published 5 days ago

dynmr v2.0.0-alpha.4

Weekly downloads
-
License
MIT
Repository
github
Last release
5 days ago

Dynmr is a library to use AWS DynamoDB type-safely.

Getting Started

npm i dynmr @aws-sdk/client-dynamodb

Example

import { DynamoDBClient } from '@aws-sdk/client-dynamodb';
import { type DynmrSchema, createDynmr } from 'dynmr';

const config = {
  user: {
    id: { type: 'S' },
    name: { type: 'S', optional: true },
    age: { type: 'N' },
    sex: { type: 'S', enum: ['male', 'female'] as const },
  },
} satisfies DynmrSchema;

const client = createDynmr({
  dynamodb: new DynamoDBClient({}),
  tableName: 'xxx',
  schema: config,
});

await client.user.put({
  id: 'xxx',
  name: 'John Doe',
  age: 25,
  sex: 'male',
});

const user = await client.user.pick({
  where: { id: { eq: 'xxx' } },
});

if (user == null) {
  throw new Error('user not found');
}

await client.user.update({
  ...user,
  age: user.age + 1,
});

await client.user.del({ dynmrId });
2.0.0-alpha.3

5 days ago

2.0.0-alpha.4

5 days ago

2.0.0-alpha.1

5 days ago

2.0.0-alpha.2

5 days ago

2.0.0-alpha.0

7 days ago

1.8.5

9 days ago

1.8.4

9 days ago

1.8.3

9 days ago

1.8.2

1 month ago

1.8.1

2 months ago

1.8.0

7 months ago

1.7.9

7 months ago

1.7.8

7 months ago

1.7.7

7 months ago

1.7.6

7 months ago

1.7.5

7 months ago

1.7.4

7 months ago

1.7.3

8 months ago

1.7.2

8 months ago

1.7.1

8 months ago

1.7.0

8 months ago

1.6.1

8 months ago

1.6.0

8 months ago

1.5.1

8 months ago

1.5.0

8 months ago

1.4.2

8 months ago

1.4.1

8 months ago

1.4.0

8 months ago

1.3.0

8 months ago

1.2.2

8 months ago

1.2.1

8 months ago

1.2.0

8 months ago

1.1.0

8 months ago

1.0.1

8 months ago

1.0.0

8 months ago