Open ziggy6792 opened 3 years ago
Hi, did anyone find any solution of this? I am also looking for the same!
You can use the getSchema
and getTableName
functions exported by the data mapper package.
To extract the table keys, you can also use the keysFromSchema
function (invoke it with the value returned by getSchema
).
Firstly awesome tool I really enjoy using it thanks a lot!
My question
Lets say I have an annotated domain object e.g
This means that from another .ts file I can do something like
But is there anyway that I can get the table information (i.e; tableName with prefix, hashKey, rangeKey).
I would want something like
Why I want to do this
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 withdynamodb-data-mapper-js