mirror of
https://github.com/floci-io/floci.git
synced 2026-11-24 06:20:24 -05:00
Merge branch 'main' into fix/s3-memory-mode-and-storage-defaults
This commit is contained in:
commit
f992ee2294
9 files changed
+388
-3
No files matched your search
@@ -38,6 +38,9 @@ public interface EmulatorConfig {
|
||||
@WithDefault("000000000000")
|
||||
String defaultAccountId();
|
||||
|
||||
@WithDefault("512")
|
||||
int maxRequestSize();
|
||||
|
||||
StorageConfig storage();
|
||||
|
||||
AuthConfig auth();
|
||||
|
||||
@@ -887,11 +887,41 @@ public class DynamoDbService {
|
||||
}
|
||||
|
||||
// Resolve the value
|
||||
if (valuePart.startsWith(":") && exprAttrValues != null) {
|
||||
if (valuePart.startsWith("if_not_exists(")) {
|
||||
// if_not_exists(attrRef, fallbackExpr) evaluates to:
|
||||
// attrRef's current value — when attrRef exists in the item
|
||||
// fallbackExpr — otherwise
|
||||
// The result is always assigned to attrName.
|
||||
String[] args = extractFunctionArgs(valuePart);
|
||||
if (args.length == 2) {
|
||||
String checkAttr = resolveAttributeName(args[0].trim(), exprAttrNames);
|
||||
String fallbackExpr = args[1].trim();
|
||||
JsonNode resolved;
|
||||
if (item.has(checkAttr)) {
|
||||
// attrRef exists — evaluate to its current value
|
||||
resolved = item.get(checkAttr);
|
||||
} else if (fallbackExpr.startsWith(":") && exprAttrValues != null) {
|
||||
resolved = exprAttrValues.get(fallbackExpr);
|
||||
} else {
|
||||
// fallback is itself an attribute reference
|
||||
resolved = item.get(resolveAttributeName(fallbackExpr, exprAttrNames));
|
||||
}
|
||||
if (resolved != null) {
|
||||
item.set(attrName, resolved);
|
||||
}
|
||||
}
|
||||
} else if (valuePart.startsWith(":") && exprAttrValues != null) {
|
||||
JsonNode value = exprAttrValues.get(valuePart);
|
||||
if (value != null) {
|
||||
item.set(attrName, value);
|
||||
}
|
||||
} else if (!valuePart.isEmpty()) {
|
||||
// Plain attribute reference: SET a = b or SET a = #alias
|
||||
String refAttr = resolveAttributeName(valuePart, exprAttrNames);
|
||||
JsonNode refValue = item.get(refAttr);
|
||||
if (refValue != null) {
|
||||
item.set(attrName, refValue);
|
||||
}
|
||||
}
|
||||
|
||||
clause = rest;
|
||||
|
||||
Reference in new issue
Block a user