Skip to main content

PutItem

Store.put()

Create a put query.

import { DynamoDBClient } from '@aws-cdk/client-dynamodb'
import { Store } from '@declanprice/dynostore'

const store = new Store('CustomerTable', new DynamoDBClient())

const request = store.put<CustomerItem>()

item(object)

Provide the item to put.

request.item({ id: '1', firstName: 'John' });

condition(...conditions)

Provide any combination of supported dynamodb conditions, multiple conditions must be seperated by either and(), or() conditions otherwise an error will be thrown.

request
.condition(eq('name', 'John'), and(), gt('age', 22))
// automatically separates two stacked condition calls with `and()` condition.
.condition(eq('address', '1/1 address st')

return(returnValue)

Provide return value from of the response.

request.return('ALL_NEW')

exec()

Execute the request.

await request.exec();

tx()

Create a TransactPutItem.

const putCustomerTxItem = request.tx();