expressions.js 624 B

12345678910111213141516171819202122
  1. import { bindIfParam } from "../sql/expressions/index.js";
  2. import { sql } from "../sql/sql.js";
  3. export * from "../sql/expressions/index.js";
  4. function concat(column, value) {
  5. return sql`${column} || ${bindIfParam(value, column)}`;
  6. }
  7. function substring(column, { from, for: _for }) {
  8. const chunks = [sql`substring(`, column];
  9. if (from !== void 0) {
  10. chunks.push(sql` from `, bindIfParam(from, column));
  11. }
  12. if (_for !== void 0) {
  13. chunks.push(sql` for `, bindIfParam(_for, column));
  14. }
  15. chunks.push(sql`)`);
  16. return sql.join(chunks);
  17. }
  18. export {
  19. concat,
  20. substring
  21. };
  22. //# sourceMappingURL=expressions.js.map