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