Skip to main content

DeleteItem

Store.delete()

Create a delete query.

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

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

const request = await store.delete<CustomerItem>();

key(key)

Provide the item key to delete.

request.key({id: '1' });

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(notExists('id'), and(), not(eq('name'), 'declan'))

return(returnValue)

Provide return the old item as part of the response.

request.return('ALL_OLD')

exec()

Execute the request.

const oldCustomer = await request.exec()

tx()

Create a TransactDeleteItem.

const deleteCustomerTxItem = request.tx()