BatchGet
Command to perform a batch get operation on a DynamoDB table.
Example
Section titled “Example”import { DynamoTable, DynamoEntity, key, BatchGet } 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(), age: z.number(), }), partitionKey: user => key('USER', user.userId), sortKey: () => 'USER',});
const batchGetCommand = new BatchGet({ keys: [ { userId: 'user1' }, { userId: 'user2' }, ], consistent: true,});
const { items } = await batchGetCommand.execute(userEntity);Type 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<BatchGetResult<Schema>,Schema>
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new BatchGet<Schema>(config): BatchGet<Schema>;Parameters
Section titled “Parameters”config
Section titled “config”BatchGetConfig<Schema>
Returns
Section titled “Returns”BatchGet<Schema>
Methods
Section titled “Methods”execute()
Section titled “execute()”execute(entity): Promise<BatchGetResult<Schema>>;Parameters
Section titled “Parameters”entity
Section titled “entity”DynamoEntity<Schema>
Returns
Section titled “Returns”Promise<BatchGetResult<Schema>>