serial.cjs 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  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 serial_exports = {};
  20. __export(serial_exports, {
  21. PgSerial: () => PgSerial,
  22. PgSerialBuilder: () => PgSerialBuilder,
  23. serial: () => serial
  24. });
  25. module.exports = __toCommonJS(serial_exports);
  26. var import_entity = require("../../entity.cjs");
  27. var import_common = require("./common.cjs");
  28. class PgSerialBuilder extends import_common.PgColumnBuilder {
  29. static [import_entity.entityKind] = "PgSerialBuilder";
  30. constructor(name) {
  31. super(name, "number", "PgSerial");
  32. this.config.hasDefault = true;
  33. this.config.notNull = true;
  34. }
  35. /** @internal */
  36. build(table) {
  37. return new PgSerial(table, this.config);
  38. }
  39. }
  40. class PgSerial extends import_common.PgColumn {
  41. static [import_entity.entityKind] = "PgSerial";
  42. getSQLType() {
  43. return "serial";
  44. }
  45. }
  46. function serial(name) {
  47. return new PgSerialBuilder(name ?? "");
  48. }
  49. // Annotate the CommonJS export names for ESM import in node:
  50. 0 && (module.exports = {
  51. PgSerial,
  52. PgSerialBuilder,
  53. serial
  54. });
  55. //# sourceMappingURL=serial.cjs.map