text.cjs 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  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 __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
  19. var text_exports = {};
  20. __export(text_exports, {
  21. PgText: () => PgText,
  22. PgTextBuilder: () => PgTextBuilder,
  23. text: () => text
  24. });
  25. module.exports = __toCommonJS(text_exports);
  26. var import_entity = require("../../entity.cjs");
  27. var import_utils = require("../../utils.cjs");
  28. var import_common = require("./common.cjs");
  29. class PgTextBuilder extends import_common.PgColumnBuilder {
  30. static [import_entity.entityKind] = "PgTextBuilder";
  31. constructor(name, config) {
  32. super(name, "string", "PgText");
  33. this.config.enumValues = config.enum;
  34. }
  35. /** @internal */
  36. build(table) {
  37. return new PgText(table, this.config);
  38. }
  39. }
  40. class PgText extends import_common.PgColumn {
  41. static [import_entity.entityKind] = "PgText";
  42. enumValues = this.config.enumValues;
  43. getSQLType() {
  44. return "text";
  45. }
  46. }
  47. function text(a, b = {}) {
  48. const { name, config } = (0, import_utils.getColumnNameAndConfig)(a, b);
  49. return new PgTextBuilder(name, config);
  50. }
  51. // Annotate the CommonJS export names for ESM import in node:
  52. 0 && (module.exports = {
  53. PgText,
  54. PgTextBuilder,
  55. text
  56. });
  57. //# sourceMappingURL=text.cjs.map