UNPKG

betterddb

Version:

A definition-based DynamoDB wrapper library that provides a schema-driven and fully typesafe DAL.

37 lines 1.5 kB
import { type NativeAttributeValue } from "@aws-sdk/lib-dynamodb"; import { type BetterDDB } from "../betterddb.js"; import { type TransactWriteItem } from "@aws-sdk/client-dynamodb"; export declare class UpdateBuilder<T> { private parent; private key; private actions; private condition?; private extraTransactItems; constructor(parent: BetterDDB<T>, key: Partial<T>); set(attrs: Partial<T>): this; remove(attrs: (keyof T)[]): this; add(attrs: Partial<Record<keyof T, number | Set<NativeAttributeValue>>>): this; delete(attrs: Partial<Record<keyof T, Set<NativeAttributeValue>>>): this; /** * Adds a condition expression to the update. */ setCondition(expression: string, attributeValues: Record<string, NativeAttributeValue>, attributeNames: Record<string, string>): this; /** * Specifies additional transaction items to include when executing this update as a transaction. */ transactWrite(ops: TransactWriteItem[] | TransactWriteItem): this; /** * Builds the update expression and associated maps. */ private buildExpression; /** * Returns a transaction update item that can be included in a transactWrite call. */ toTransactUpdate(newItemForIndexes?: T): Promise<TransactWriteItem>; private createExpectedNewItem; /** * Commits the update immediately by calling the parent's update method. */ execute(): Promise<T>; } //# sourceMappingURL=update-builder.d.ts.map