async batchGetItem(
tnmInput: TynamoBatchGetItemInput<TSource>
): Promise<TynamoBatchGetItemOutput<TSource>>
export interface TynamoBatchGetItemInput<TSource> {
RequestItems: Partial<TSource>[];
// Derived from DynamoDB.
ReturnConsumedCapacity?: ReturnConsumedCapacity;
ConsistentRead?: ConsistentRead;
ProjectionExpression?: ProjectionExpression;
ExpressionAttributeNames?: ExpressionAttributeNameMap;
}
export interface TynamoBatchGetItemOutput<TSource> {
Responses?: TSource[];
UnprocessedKeys?: Partial<TSource>[];
// Derived from DynamoDB.
$response?: Response<BatchGetItemOutput, AWSError>;
ConsumedCapacity?: ConsumedCapacityMultiple;
}
@DynamoEntity()
class Cat {
@DynamoProperty({ keyType: KeyType.hash })
id!: number;
@DynamoProperty({ keyType: KeyType.attr })
name!: string;
constructor(id: number, name: string) {
this.id = id;
this.name = name;
}
}
const tynamo: Tynamo = new Tynamo({
region: "ap-northeast-2",
endpoint: "http://localhost:8000"
});
const tynamoTable = tynamo.getTableOf(Cat);
const cats: Cat[] = [];
for(let i=0; i<100; i++){
cats.push(new Cat(i, ""));
}
await tynamoTable.batchGetItem({
RequestItems: cats
});