const jsonSql = require("json-sql")({
namedValues: false,
valuesPrefix: "$$",
});
jsonSql.setDialect("mysql");
const sql = jsonSql.build({
type: "update",
table: "table1",
condition: {
guid: id,
},
modifier: updateFields,
});
/// CONVERT placeholders
const query1 = sql.query.replace(/\$\$\d+/g, "?");
[mariadb/mysql] does not support named placeholders like :col1 - use ? instead
Maybe this can be built into the mysql dialect?