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)
- Missing json => dynamodbav v2 migration HOT 1
- DynamoDB:UpdateItem ReturnValuesOnConditionCheckFailure flag does not work HOT 5
- Get Filtered Repositories from ECR(short issue description) HOT 2
- S3: False Request and 'Object Not Found' Error When Bucket Name Matches Object Key Prefix and usePathStyle is False HOT 2
- S3: `DeleteObjects` Creates File Versions and Delete Markers Regardless of File Existence with `ObjectLockEnabledForBucket` Set to True HOT 4
- Include imitation of 10 message attributes field for sns.PublishInput in godoc HOT 2
- SSO Cache filename should be based on `sso_session` in addition to `sso_start_url` HOT 4
- PresignedPutObject ignores ChecksumAlgorithm HOT 2
- No paginator for DescribeLockedSnapshots? HOT 2
- [inspector2] GetConfiguration is missing the `ec2Configuration` object HOT 3
- Provide io.Reader wrapper around S3 SelectObjectContentEventStream
- Expand Codebuild to accept the new WebhookFilterType of `WORKFLOW_JOB_QUEUED` HOT 3
- How to set a field to NULL using the Redshift Data API? HOT 2
- Bad request when describe key pairs with empty filters slice HOT 13
- EC2Query empty list serialization behavior is incorrect HOT 1
- S3: intermittent TLS 1.3 handshake failures HOT 2
- Support generic SigV4 and SigV4A signers
- package docs for github.com/aws/aws-sdk-go-v2/aws/signer/v4 are malformed HOT 2
- Something changed from version v1.22.2 to v1.26.1 and I can't find what HOT 1
- Add public constant values for Redshift Cluster - ClusterStatus HOT 2
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.