Open wolever opened 5 years ago
For example:
const columns = SQL.raw("foo, bar"); const whereClause = SQL`foo = ${someValue}`; const query = SQL`SELECT ${columns} FROM table WHERE ${whereClause}`;
TODO:
SQL.join
const fields = { foo: 'hello', bar: 'world', } const updateClause = SQL.join(', ', Object.entries(fields).map(([col, val]) => { return SQL`${SQL.raw(escapeLiteral(col))} = ${val}` }) const query = SQL`UPDATE table SET ${updateClause} WHERE ...`
For example:
TODO:
SQL.join
helper: