Skip to content
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

dynamodb/expression: Value doesn't work as expected with dynamodb.AttributeValue #713

Closed
3 tasks done
sudhirj opened this issue Sep 7, 2020 · 2 comments · Fixed by #981
Closed
3 tasks done

dynamodb/expression: Value doesn't work as expected with dynamodb.AttributeValue #713

sudhirj opened this issue Sep 7, 2020 · 2 comments · Fixed by #981
Labels
feature-request A feature should be added or improved.

Comments

@sudhirj
Copy link

sudhirj commented Sep 7, 2020

Confirm by changing [ ] to [x] below to ensure that it's a bug:

Describe the bug
Calling expression.Value() with a dynamodb.AttributeValue dumps the full JSON structure instead of using the given value.

Version of AWS SDK for Go?
Latest

Version of Go (go version)?
Latest

To Reproduce (observed behavior)

update.Set(
			expression.Name("key"),
			expression.Value(dynamodb.AttributeValue{
				S: aws.String("value"),
			}),
		)

Expected behavior
I'd expect the value to be set correctly typed to a string.

Additional context
There seems to be type based coercion going on to put the value into an AttributeValue, but if it already is one we should be able to just take it as-is.

@sudhirj sudhirj added the bug This issue is a bug. label Sep 7, 2020
@sudhirj
Copy link
Author

sudhirj commented Sep 8, 2020

Specifically, here we can either avoid calling dynamodbattribute.Marshal on the values if they already of type dynamodb.AttributeValue, or we can do the check inside the encode method.

I'm happy to raise a PR if the maintainers can specify which approach would be more agreeable.

@jasdel jasdel changed the title expression.Value doesn't work correctly with dynamodb.AttributeValue dynamodb/expression: Value doesn't work as expected with dynamodb.AttributeValue Nov 11, 2020
@jasdel jasdel added feature-request A feature should be added or improved. and removed bug This issue is a bug. labels Nov 11, 2020
@github-actions
Copy link

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see.
If you need more assistance, please either tag a team member or open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request A feature should be added or improved.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants