Utility for easier interaction with DynamoDB
Inside your project directory, run the following:
yarn add dynm
Or with npm:
npm install dynm
Example can be found at /test
- Default primaryKey is set to
id
import {Dynm} from "dynm";
const dynm = new Dynm("table");
const result = await dynm.get("key");
if (result.ok) {
console.log(result.value.Item);
} else {
console.log(result.value.message);
}
createBaseTable(name: string)
- Creates base table with specified name and with primaryKeyget(id: string)
- Gets one item from table by idgetBatch(id: string[])
- Gets multiple items from table by idadd<T>(data: T, replace?: boolean)
- Inserts and/or replaces new item to tableaddBatch<T>(data: T[])
- Inserts new items to tableupdate<T>(id: string, data: T)
- Updates one item from table by id and returns full item with new valuesdelete(id: string)
- Deletes one item from table by idall()
- Gets all items from table
The MIT License.