1.0.0 • Published 1 year ago
@declanprice/dynostore v1.0.0
Dynostore
Dynostore is a minimal no magic query builder for dynamodb, it's a simple layer on top of the native dynamodb AWS V3 SDK API.
// QueryItems
await store.query<CustomerInvoiceItem>()
.pk(eq('id', 'customer-1'))
.sk(beginsWith('sk', 'invoice-'))
.exec()// GetItem
await store.get<CustomerItem>()
.key({ id: customer.id })
.exec()// UpdateItem
await store
.update()
.key({ id: customer.id })
.update(set('firstName', 'john'), set('lastName', 'doe'), increment('version', 1))
.condition(notExists('id'), or(), eq('name', 'john'))
.exec()// PutItem
await store.put<CustomerItem>()
.item({ id: 'customer-1', name: 'declan' })
.exec()// DeleteItem
await store
.delete()
.key({ id: 'customer-1' })
.exec()// ScanItems
await store.scan<any>()
.filter(eq('name', 'john'))
.exec()See Documentation for more in depth usage.