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