shiftcode / dynamo-easy

DynamoDB client for NodeJS and browser with a fluent api to build requests. We take care of the type mapping between JS and DynamoDB, customizable trough typescript decorators.
https://shiftcode.github.io/dynamo-easy/
MIT License
204 stars 27 forks source link

Support Null Values #285

Open simonmumenthaler opened 4 years ago

simonmumenthaler commented 4 years ago

The default behaviour of dynamo-easy filters out all null (or undefined) values before the mapper function toDb is called. So it's not possible to store null as { NULL: true }

It'd be nice to have real null value support.

It could be sth like this:

@Property({ nullable: true, type: String })
myProperty: string | null

--> as soon as we define string | null as type it's necessary to provide the actual type to the decorator since reading the reflection information design:type will return Object.

Another option would be to globally define how to handle null values. But then it's less explicit and I think the default behaviour of not storing null is mostly preferred.

dhmw commented 2 years ago

This is absurd - how can this not be implemented?

dhmw commented 2 years ago

I looked into this a bit and found that null was being deliberately excluded from mapping; I've raised a PR to rectify this: https://github.com/shiftcode/dynamo-easy/pull/361