expressions.cjs 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. "use strict";
  2. var __defProp = Object.defineProperty;
  3. var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
  4. var __getOwnPropNames = Object.getOwnPropertyNames;
  5. var __hasOwnProp = Object.prototype.hasOwnProperty;
  6. var __export = (target, all) => {
  7. for (var name in all)
  8. __defProp(target, name, { get: all[name], enumerable: true });
  9. };
  10. var __copyProps = (to, from, except, desc) => {
  11. if (from && typeof from === "object" || typeof from === "function") {
  12. for (let key of __getOwnPropNames(from))
  13. if (!__hasOwnProp.call(to, key) && key !== except)
  14. __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
  15. }
  16. return to;
  17. };
  18. var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
  19. var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
  20. var expressions_exports = {};
  21. __export(expressions_exports, {
  22. concat: () => concat,
  23. rowId: () => rowId,
  24. substring: () => substring
  25. });
  26. module.exports = __toCommonJS(expressions_exports);
  27. var import_expressions = require("../sql/expressions/index.cjs");
  28. var import_sql = require("../sql/sql.cjs");
  29. __reExport(expressions_exports, require("../sql/expressions/index.cjs"), module.exports);
  30. function concat(column, value) {
  31. return import_sql.sql`${column} || ${(0, import_expressions.bindIfParam)(value, column)}`;
  32. }
  33. function substring(column, { from, for: _for }) {
  34. const chunks = [import_sql.sql`substring(`, column];
  35. if (from !== void 0) {
  36. chunks.push(import_sql.sql` from `, (0, import_expressions.bindIfParam)(from, column));
  37. }
  38. if (_for !== void 0) {
  39. chunks.push(import_sql.sql` for `, (0, import_expressions.bindIfParam)(_for, column));
  40. }
  41. chunks.push(import_sql.sql`)`);
  42. return import_sql.sql.join(chunks);
  43. }
  44. function rowId() {
  45. return import_sql.sql`rowid`;
  46. }
  47. // Annotate the CommonJS export names for ESM import in node:
  48. 0 && (module.exports = {
  49. concat,
  50. rowId,
  51. substring,
  52. ...require("../sql/expressions/index.cjs")
  53. });
  54. //# sourceMappingURL=expressions.cjs.map