You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jun 19, 2023. It is now read-only.
Firstly awesome tool I really enjoy using it thanks a lot!
My question
Lets say I have an annotated domain object e.g
import { attribute, table, hashKey } from '@aws/dynamodb-data-mapper-annotations';
import { v4 as uuidv4 } from 'uuid';
abstract class Identifiable {
@hashKey({ defaultProvider: () => uuidv4() })
id: string;
}
@table('User')
class User extends Identifiable {
@rangeKey()
email: string;
@attribute()
firstName: string;
@attribute()
lastName: string;
}
export default User;
This means that from another .ts file I can do something like
import User from 'path/to/user'
mapper.ensureTableExists(User, {readCapacityUnits: 5, writeCapacityUnits: 5})
.then(() => {
// the table has been provisioned and is ready for use!
})
But is there anyway that I can get the table information (i.e; tableName with prefix, hashKey, rangeKey).
I am using dynamodb-data-mapper-js in a lambda function and building my stack with CDK. I don't want to have to define my schema (table names, hash keys etc..) twice (once in the lambda for using that tables and once in CDK for building them). I would rather be able to build the tables by importing the schema defined with dynamodb-data-mapper-js