char.cjs 2.0 KB

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