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

aws-sdk-go's PutItem() never returns a nil pointer #34

Open
danny-cheung opened this issue Jan 6, 2021 · 0 comments
Open

aws-sdk-go's PutItem() never returns a nil pointer #34

danny-cheung opened this issue Jan 6, 2021 · 0 comments

Comments

@danny-cheung
Copy link
Contributor

I am testing that we gracefully handle conditional write errors.

In my particular case, write an item, but don't overwrite it if already exists.

  • Operation = PutItemWithContext()
  • Condition = attribute_not_exist(id)

If an object with the same id exists, aws-sdk-go will return an error and a pointer to a blank PutItemOutput object. https://github.com/aws/aws-sdk-go/blob/v1.36.19/service/dynamodb/api.go#L4382

Simulating an error in Dynamock, a nil PutItemOutput pointer is returned. https://github.com/gusaul/go-dynamock/blob/master/put_item.go#L69

This becomes a problem when wrapper libraries relies/assumes AWS's behaviour. e.g. https://github.com/guregu/dynamo/blob/master/put.go#L97-L101

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant