expressions.cjs 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  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. substring: () => substring
  24. });
  25. module.exports = __toCommonJS(expressions_exports);
  26. var import_expressions = require("../sql/expressions/index.cjs");
  27. var import_sql = require("../sql/sql.cjs");
  28. __reExport(expressions_exports, require("../sql/expressions/index.cjs"), module.exports);
  29. function concat(column, value) {
  30. return import_sql.sql`${column} || ${(0, import_expressions.bindIfParam)(value, column)}`;
  31. }
  32. function substring(column, { from, for: _for }) {
  33. const chunks = [import_sql.sql`substring(`, column];
  34. if (from !== void 0) {
  35. chunks.push(import_sql.sql` from `, (0, import_expressions.bindIfParam)(from, column));
  36. }
  37. if (_for !== void 0) {
  38. chunks.push(import_sql.sql` for `, (0, import_expressions.bindIfParam)(_for, column));
  39. }
  40. chunks.push(import_sql.sql`)`);
  41. return import_sql.sql.join(chunks);
  42. }
  43. // Annotate the CommonJS export names for ESM import in node:
  44. 0 && (module.exports = {
  45. concat,
  46. substring,
  47. ...require("../sql/expressions/index.cjs")
  48. });
  49. //# sourceMappingURL=expressions.cjs.map