Comments (12)
Thanks for the feedback @kaihendry. To help improve the usability of the DynamoDB expressions, we created the DynamoDB expression package. This package provides a lot of builders to construct these expressions so you don't have to do it by hand. The package takes care of the escaping, and reserved words.
This will address most of the issue that you're running into with the expression statement. Here is an example for building an Update expression.
from aws-sdk-go-v2.
Sorry about that. The old link was to a test I ran. The developer guide has an example: https://docs.aws.amazon.com/sdk-for-go/v1/developer-guide/dynamo-example-update-table-item.html
from aws-sdk-go-v2.
~$ curl https://alpha-docs-aws.amazon.com/sdk-for-go/v1/developer-guide/dynamo-example-update-table-item.html
curl: (6) Could not resolve host: alpha-docs-aws.amazon.com
from aws-sdk-go-v2.
Found a great example via Github search here: https://github.com/aws/aws-sdk-go-v2/blob/master/service/dynamodb/expression/examples_test.go
github.com/aws/aws-sdk-go-v2/service/dynamodb/expression is a godsend! However if my values are empty strings, boolean "true" seem to get set in my results. My workaround is to check they are empty atm.
from aws-sdk-go-v2.
Hmm, also noticed I don't have to dynamodbattribute.MarshalList my values when using this. Less code. I'm all for it.
from aws-sdk-go-v2.
Thanks for the feedback @kaihendry. You can add the struct tag dynamodb:",omitempty"
to the fields that should be not be marshaled. This tag works similar to JSON's omitempty and will not marshal the field if it is a nil pointer or zero value.
Alternatively, you can create a dynamodbattribute.Encoder
manually and set the "NULLEmptyString" option to instruct the encoder to replace empty string fields with NULL.
from aws-sdk-go-v2.
Cool, will try. But the default "true" is a bit unexpected for an empty value, no?
from aws-sdk-go-v2.
@kaihendry - The encoding/json
package works the same way. So we wanted to be consistent with what the standard library was already doing.
from aws-sdk-go-v2.
@xibz .. wait, in JSON strings are empty when empty. Not booleans!
cat Gopkg.toml
[[constraint]]
name = "github.com/aws/aws-sdk-go-v2"
version = "2.0.0-preview.1"
https://play.golang.org/p/f7HC9x2iBNp
from aws-sdk-go-v2.
Thanks for the sample code @kaihendry. I think what you're seeing here is a confusing aspect of the DynamoDB Console's UI. If you click on foobar
item and view its details in the console you'll see the Title
field's value isn't true
, but null
. I think the DynamoDB Console UI is showing the wrong value here. It should be showing null
instead.
It would be very helpful if you could use the DynamoDB console's Feedback
link in the far bottom left hand corner of the screen to send this UI bug to the DynamoDB console team.
Here's what the text view of the item's value probably looks like.
from aws-sdk-go-v2.
Argh, you're right. Sorry for the noise. 🤦♂️
from aws-sdk-go-v2.
We have noticed this issue has not received attention in 1 year. We will close this issue for now. If you think this is in error, please feel free to comment and reopen the issue.
from aws-sdk-go-v2.
Related Issues (20)
- S3 upload manager retry broken with seekable body HOT 4
- DynamoDB does not return TableAlreadyExistsException when CreateTable is called for an existing table name HOT 3
- Inaccessible ResultMetadata in bedrockruntime service response HOT 5
- Incorrect description of a field `ParserMode` of `bedrockagent.types.PromptConfiguration` HOT 4
- Incorrect state returned in VPCEndpoint Object HOT 2
- Missing release notes for 1.25.0 HOT 2
- ram api not hitting the correct endpoint. HOT 2
- Unset/zero-value region should explicitly fail endpoint resolution HOT 1
- UnmarshalListOfMaps is failed if list of custom struct is set into argument 'out'
- Refactor operation builders to only modify the middleware stack within their own module's context HOT 1
- Align SDK presigning behavior of expected bucket owner to match S3's
- Glacier - signature we calculated does not match the signature you provided when uploading in parallel HOT 3
- PutObject does not add Content-Length in the headers when it is specified in the parameters and the body is not Seekable HOT 3
- chunked transfer with s3 ops doesn't respect explicit content length with io.PipeReader
- [bug] sts get caller identity does not work immediately HOT 14
- endpointdiscovery.Endpointcache will panic on 32-bit archs HOT 1
- Field DeleteMarker in HeadObjectOutput is not usable HOT 1
- Impossible to generate clients for non-aws services due to dependency on aws.api#Service trait HOT 4
- "SignatureDoesNotMatch" Error When Using PresignPutObject with Expires HOT 4
- GetObject result.ContentLength different from Response Content HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from aws-sdk-go-v2.