double-precision.js 898 B

123456789101112131415161718192021222324252627282930313233343536
  1. import { entityKind } from "../../entity.js";
  2. import { GelColumn, GelColumnBuilder } from "./common.js";
  3. class GelDoublePrecisionBuilder extends GelColumnBuilder {
  4. static [entityKind] = "GelDoublePrecisionBuilder";
  5. constructor(name) {
  6. super(name, "number", "GelDoublePrecision");
  7. }
  8. /** @internal */
  9. build(table) {
  10. return new GelDoublePrecision(
  11. table,
  12. this.config
  13. );
  14. }
  15. }
  16. class GelDoublePrecision extends GelColumn {
  17. static [entityKind] = "GelDoublePrecision";
  18. getSQLType() {
  19. return "double precision";
  20. }
  21. mapFromDriverValue(value) {
  22. if (typeof value === "string") {
  23. return Number.parseFloat(value);
  24. }
  25. return value;
  26. }
  27. }
  28. function doublePrecision(name) {
  29. return new GelDoublePrecisionBuilder(name ?? "");
  30. }
  31. export {
  32. GelDoublePrecision,
  33. GelDoublePrecisionBuilder,
  34. doublePrecision
  35. };
  36. //# sourceMappingURL=double-precision.js.map