varchar.cjs 2.1 KB

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