-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Convert objects to DynamoDB Maps for storage #92
base: master
Are you sure you want to change the base?
Conversation
…ems that is the standard. Correct JSDoc annotation as the objectToValue function can also return objects
Is this accurate @xiao @eduardoramirez ? :) |
hey @gregory, yes it should for the most part be compliant. Of course, there will be features that we don't use at Medium that are not implemented though. |
} else { | ||
throw new Error('Invalid dynamo set value. Type: ' + firstItemType + ', Value: ' + value[0]) | ||
} | ||
} else if (typeof value == "object") { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we move this condition to the top level switch?
@@ -24,7 +24,7 @@ | |||
"dependencies": { | |||
"kew": "0.7.0", | |||
"typ": "0.6.3", | |||
"aws-sdk": "2.2.47" | |||
"aws-sdk": "2.5.1" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is there a reason here why we're updating the sdk?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Apologies, but this is something I did 2 years ago while implementing something for a former client, and I don't honestly recall the context here. If this PR is useful to others I can try and setup something to test it with the previous aws-sdk and see what happens, but I cannot promise when I will have time to do so.
Please consider this a response to all three of your questions.
@@ -90,6 +90,9 @@ function valueToObject(value) { | |||
return {N: String(value)} | |||
default: | |||
if (Array.isArray(value)) { | |||
if (value.length == 0) | |||
return {L: []} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what are the implications here if the type of this list isn't of attributes?
Looks like the code for reading maps from DynamoDB was added recently, but it fails when storing nested objects. This seems to make it work for me.