async deleteItem(
tnmInput: TynamoDeleteItemInput<TSource>
): Promise<TynamoDeleteItemOutput<TSource>>
export interface TynamoDeleteItemInput<TSource> {
Key: Partial<TSource>;
ExpressionAttributeValues?: any;
// Derived from DynamoDB.
ReturnValues?: ReturnValue;
ReturnConsumedCapacity?: ReturnConsumedCapacity;
ReturnItemCollectionMetrics?: ReturnItemCollectionMetrics;
ConditionExpression?: ConditionExpression;
ExpressionAttributeNames?: ExpressionAttributeNameMap;
}
export interface TynamoUpdateItemOutput<TSource> {
Attributes?: TSource;
// Derived from DynamoDB.
$response: AWS.Response<DeleteItemOutput, AWS.AWSError>;
ConsumedCapacity?: ConsumedCapacity;
ItemCollectionMetrics?: ItemCollectionMetrics;
}
@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);
await tynamoTable.deleteItem({
Key: new Cat(666, ""),
});