Comments (5)
hi @mikestopcontinues, thanks for your suggestion. I have it implemented on PR #10 but don't have access to a DDB right now so I can't test one assumption, maybe you can help?
The docs are not very explicit about how the UpdateExpression
should be constructed. I'm guessing it's just a simple concatenation of the different clauses starting with keywords SET/ADD/REMOVE/DELETE:
Given this input to dynoexpr
:
{
UpdateSet: { ufoo: 'ufoo - 2' },
UpdateRemove: { rfoo: 'rbar' },
UpdateAdd: { afoo: 'abar' },
UpdateDelete: { dfoo: 'dbar' },
}
It would produce:
{
UpdateExpression:
'SET #nff12 = #nff12 - :v862c REMOVE #nff12, #n978b ADD #nb01c :ve948 DELETE #nd358 :v45cc',
ExpressionAttributeNames: {
'#n978b': 'rfoo',
'#nb01c': 'afoo',
'#nd358': 'dfoo',
'#nff12': 'ufoo',
},
ExpressionAttributeValues: {
':v0e91': 'rbar',
':v45cc': 'dbar',
':v862c': 2,
':ve948': 'abar',
},
}
Is this your understanding, too? Cheers
from dynoexpr.
That was my understanding as well. I'll test it today. Thanks for your help!
from dynoexpr.
Things are looking good! SET
, REMOVE
, and ADD
(add for numbers) all work concatenated with a space. I was also able to get ADD
(for sets) and DELETE
working too, using docClient.createSet()
for the value.
On that front, does it make sense to automatically wrap any arrays in createSet()
when using ADD
and DELETE
update actions? Does that get in the way of any other behavior?
from dynoexpr.
great, I'm closing this issue now as it's fixed by the PR. I've created a new issue #11 for your createSet
suggestion.. if you could add an example of the expected behavior to that issue, it would be of great help
from dynoexpr.
Thanks again!
from dynoexpr.
Related Issues (20)
- wrap arrays in createSet when using ADD and DELETE update actions HOT 2
- Cannot find module 'dynoexpr' or its corresponding type declarations. HOT 2
- Type error on params being passed into `docClient.update` HOT 3
- Array of objects HOT 2
- UpdateAdd attributes don't match HOT 3
- Question: Support for multiple values for the same attribute HOT 4
- Remove dependency on AWS-SDK HOT 6
- New build style in 1.24 and 1.25 causing new errors HOT 8
- `dynoexpr` should handle `null` value type HOT 5
- not contains not working HOT 2
- High Severity Security Issue In aws-sdk Dependency HOT 2
- logical operator "OR" doesn't work HOT 2
- dynoexpr doesn't support if_not_exists HOT 2
- can't use comparison operator "<>" with boolean value HOT 2
- A combination of UpdateRemove with Condition throws an error HOT 2
- dynoexpr doesn't support list_append HOT 6
- Feature Request: Support validation of sets
- Breaking Change Not Documented HOT 4
- Dynoexpr doesn't allow to escape dynamic keys in objects 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 dynoexpr.