Skip to content

Instantly share code, notes, and snippets.

@mxro
Created June 17, 2022 23:41
Show Gist options
  • Select an option

  • Save mxro/7fa7d70ec07e981bb3c990fd25cd12bb to your computer and use it in GitHub Desktop.

Select an option

Save mxro/7fa7d70ec07e981bb3c990fd25cd12bb to your computer and use it in GitHub Desktop.
import { Table, Entity } from 'dynamodb-toolbox';
export function createTable<Name extends string>(
dynamoDB: DynamoDB.DocumentClient,
tableName: string
): Table<Name, 'pk', 'sk'> {
return new Table({
name: tableName,
partitionKey: 'pk',
sortKey: 'sk',
DocumentClient: dynamoDB,
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment