TransactGet
Command to perform a transactional read of multiple items (all-or-nothing, strongly consistent).
Example
Section titled “Example”import { DynamoTable, DynamoEntity, key, TransactGet } from 'dynamo-document-builder';
const table = new DynamoTable({ tableName: 'ExampleTable', documentClient,});
const userEntity = new DynamoEntity({ table, schema: z.object({ userId: z.string(), name: z.string(), }), partitionKey: user => key('USER', user.userId), sortKey: () => 'METADATA',});
const transactGetCommand = new TransactGet({ keys: [ { userId: 'user1' }, { userId: 'user2' }, ],});
const { items } = await userEntity.send(transactGetCommand);// items array has same order as keys, undefined if not foundType Parameters
Section titled “Type Parameters”Schema
Section titled “Schema”Schema extends ZodObject
The Zod schema defining the structure of the entity.
Implements
Section titled “Implements”BaseCommand<TransactGetResult<Schema>,Schema>
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new TransactGet<Schema>(config): TransactGet<Schema>;Parameters
Section titled “Parameters”config
Section titled “config”TransactGetConfig<Schema>
Returns
Section titled “Returns”TransactGet<Schema>
Methods
Section titled “Methods”execute()
Section titled “execute()”execute(entity): Promise<TransactGetResult<Schema>>;Parameters
Section titled “Parameters”entity
Section titled “entity”DynamoEntity<Schema>
Returns
Section titled “Returns”Promise<TransactGetResult<Schema>>