Skip to content

Instantly share code, notes, and snippets.

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

  • Save mxro/6b80d0e012a860b94219b95014275aa1 to your computer and use it in GitHub Desktop.

Select an option

Save mxro/6b80d0e012a860b94219b95014275aa1 to your computer and use it in GitHub Desktop.
export function UserEntity<Name extends string>(
table: Table<Name, 'pk', 'sk'>
): Entity<User, UserKey, typeof table> {
const e = new Entity<User, UserKey, typeof table>({
name: 'User',
attributes: {
pk: { partitionKey: true },
sk: { hidden: true, sortKey: true },
name: { type: 'string', required: true },
emailVerified: { type: 'boolean', required: true },
},
table,
} as const);
return e;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment