expressions.js 675 B

1234567891011121314151617181920212223242526
  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. function rowId() {
  19. return sql`rowid`;
  20. }
  21. export {
  22. concat,
  23. rowId,
  24. substring
  25. };
  26. //# sourceMappingURL=expressions.js.map