UNPKG

dynamodb-toolbox

Version:

Lightweight and type-safe query builder for DynamoDB and TypeScript.

22 lines (21 loc) 870 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.expressAppendUpdate = void 0; const index_js_1 = require("../../symbols/index.js"); const utils_js_1 = require("./utils.js"); const expressAppendUpdate = (value, path, state) => { let setExpression = (0, utils_js_1.pathTokens)(path, 's', state); setExpression += ' = list_append(if_not_exists('; setExpression += (0, utils_js_1.pathTokens)(path, 's', state); setExpression += ', '; setExpression += (0, utils_js_1.refOrValueTokens)([], 's', state); setExpression += '), '; /** * @debt type "Fix this cast" */ setExpression += (0, utils_js_1.refOrValueTokens)(value[index_js_1.$APPEND], 's', state); setExpression += ')'; state.setExpressions.push(setExpression); return state; }; exports.expressAppendUpdate = expressAppendUpdate;