real.cjs 2.2 KB

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