text.js 798 B

12345678910111213141516171819202122232425262728293031
  1. import { entityKind } from "../../entity.js";
  2. import { getColumnNameAndConfig } from "../../utils.js";
  3. import { PgColumn, PgColumnBuilder } from "./common.js";
  4. class PgTextBuilder extends PgColumnBuilder {
  5. static [entityKind] = "PgTextBuilder";
  6. constructor(name, config) {
  7. super(name, "string", "PgText");
  8. this.config.enumValues = config.enum;
  9. }
  10. /** @internal */
  11. build(table) {
  12. return new PgText(table, this.config);
  13. }
  14. }
  15. class PgText extends PgColumn {
  16. static [entityKind] = "PgText";
  17. enumValues = this.config.enumValues;
  18. getSQLType() {
  19. return "text";
  20. }
  21. }
  22. function text(a, b = {}) {
  23. const { name, config } = getColumnNameAndConfig(a, b);
  24. return new PgTextBuilder(name, config);
  25. }
  26. export {
  27. PgText,
  28. PgTextBuilder,
  29. text
  30. };
  31. //# sourceMappingURL=text.js.map