Skip to content

Easily update the tablename #337

Description

@andreujuanc

Hi it's me!
I'm checking out your library and it looks very promising. I almost got something working but:

Is your feature request related to a problem? Please describe.
I needed to set the table name on run time, but I find cumbersome to call updateDynamoEasyConfig everywhere.
I do not have a "central" entry-point, so this forces my code to create that central entry point. (im doing lambdas)

Describe the solution you'd like
Since stores instances are per model. It'd be nice if we could override the values of the tablename here:
https://github.com/shiftcode/dynamo-easy/blob/master/src/dynamo/dynamo-store.ts#L36
So i could do something like :

new DynamoStore(Profile, {
   tablename: 'users-stage-98754'
})

Describe alternatives you've considered
I'm trying to set this up with updateDynamoEasyConfig but it makes my code ugly, and I cannot have it dangling since my code is serialized into a bundle, and because updateDynamoEasyConfig is not being referenced by the executing code it wont be deployed. I have similar issue in which I have to call require('reflect-metadata') because the import is not being taken into account.
So basically I'll have to copy pasta that portion of the code on every handler, or "import" a common

Thanks

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions