37 lines
831 B
Plaintext
37 lines
831 B
Plaintext
import { entityKind } from "../../entity.js";
|
|
import { PgColumn, PgColumnBuilder } from "./common.js";
|
|
class PgRealBuilder extends PgColumnBuilder {
|
|
static [entityKind] = "PgRealBuilder";
|
|
constructor(name, length) {
|
|
super(name, "number", "PgReal");
|
|
this.config.length = length;
|
|
}
|
|
/** @internal */
|
|
build(table) {
|
|
return new PgReal(table, this.config);
|
|
}
|
|
}
|
|
class PgReal extends PgColumn {
|
|
static [entityKind] = "PgReal";
|
|
constructor(table, config) {
|
|
super(table, config);
|
|
}
|
|
getSQLType() {
|
|
return "real";
|
|
}
|
|
mapFromDriverValue = (value) => {
|
|
if (typeof value === "string") {
|
|
return Number.parseFloat(value);
|
|
}
|
|
return value;
|
|
};
|
|
}
|
|
function real(name) {
|
|
return new PgRealBuilder(name ?? "");
|
|
}
|
|
export {
|
|
PgReal,
|
|
PgRealBuilder,
|
|
real
|
|
};
|
|
//# sourceMappingURL=real.js.map |