0.0.2 • Published 4 years ago
dynm v0.0.2
dynm 
Utility for easier interaction with DynamoDB
Installation
Inside your project directory, run the following:
yarn add dynmOr with npm:
npm install dynmUsage
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);
}API
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
License
The MIT License.