column.js 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. import { entityKind } from "./entity.js";
  2. class Column {
  3. constructor(table, config) {
  4. this.table = table;
  5. this.config = config;
  6. this.name = config.name;
  7. this.keyAsName = config.keyAsName;
  8. this.notNull = config.notNull;
  9. this.default = config.default;
  10. this.defaultFn = config.defaultFn;
  11. this.onUpdateFn = config.onUpdateFn;
  12. this.hasDefault = config.hasDefault;
  13. this.primary = config.primaryKey;
  14. this.isUnique = config.isUnique;
  15. this.uniqueName = config.uniqueName;
  16. this.uniqueType = config.uniqueType;
  17. this.dataType = config.dataType;
  18. this.columnType = config.columnType;
  19. this.generated = config.generated;
  20. this.generatedIdentity = config.generatedIdentity;
  21. }
  22. static [entityKind] = "Column";
  23. name;
  24. keyAsName;
  25. primary;
  26. notNull;
  27. default;
  28. defaultFn;
  29. onUpdateFn;
  30. hasDefault;
  31. isUnique;
  32. uniqueName;
  33. uniqueType;
  34. dataType;
  35. columnType;
  36. enumValues = void 0;
  37. generated = void 0;
  38. generatedIdentity = void 0;
  39. config;
  40. mapFromDriverValue(value) {
  41. return value;
  42. }
  43. mapToDriverValue(value) {
  44. return value;
  45. }
  46. // ** @internal */
  47. shouldDisableInsert() {
  48. return this.config.generated !== void 0 && this.config.generated.type !== "byDefault";
  49. }
  50. }
  51. export {
  52. Column
  53. };
  54. //# sourceMappingURL=column.js.map