Comments (6)
It works as expected right now. Thank you @ruicsh ❤️
from dynoexpr.
hi @dawidk92 thanks for your missing feature report. It's implemented on 2.14.0
. I don't have access to a DynamoDB right now, if you could test this out. I think you always need 2 args to list_append
, one of them being the key
const params = dynoexpr({
Update: { numbersArray: 'list_append([1, 2], numbersArray)' },
});
/*
{
UpdateExpression: 'SET #neb9c = list_append(:v4136, #neb9c)',
ExpressionAttributeNames: { '#neb9c': 'numbersArray' },
ExpressionAttributeValues: { ':v4136': '[1, 2]' },
}
*/
from dynoexpr.
Hi @ruicsh it's almost fine but it has a minor bug.
ExpressionAttributeValues
returns value as a string:
{ ':v4136': '[1, 2]' }
and it should be returned as an array:
{ ':v4136': [1, 2] }
DynamoDB throws this error:
ValidationException: Invalid UpdateExpression: Incorrect operand type for operator or function; operator or function: list_append, operand type: S
from dynoexpr.
hey, fixed it on v2.14.1
:
const params = dynoexpr({
Update: { numbersArray: 'list_append([1, 2], numbersArray)' },
});
/*
{
UpdateExpression: 'SET #neb9c = list_append(:veb45, #neb9c)',
ExpressionAttributeNames: { '#neb9c': 'numbersArray' },
ExpressionAttributeValues: { ':veb45': [1, 2] },
}
*/
from dynoexpr.
@ruicsh it works fine with an array of numbers but it doesn't work with an array of strings:
const params = dynoexpr({
Update: { stringsArray: 'list_append(["a", "b"], stringsArray)' },
});
/*
{
UpdateExpression: 'SET #neb9c = list_append(:veb45, #neb9c)',
ExpressionAttributeNames: { '#neb9c': 'stringsArray' },
ExpressionAttributeValues: { ':veb45': [null] },
}
*/
DynamoDB throws an error:
Error: Special numeric value NaN is not allowed
I created a temporary hack in my app where I put the output of the previously (v2.14.0
) created value from ExpressionAttributeValues
to JSON.parse()
and it works just fine. Maybe that would be a solution to that problem.
from dynoexpr.
yea, fixed it on v2.14.2
from dynoexpr.
Related Issues (20)
- FR: Support multiple update actions HOT 5
- 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
- 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.