TenantAtlas/apps/platform/.pnpm-store/v10/files/d3/5e22e0eeeb1da37d52d191cd92fcdbb0329bd3c1c6b95a57611dfc634894701267ce707b6b5a93134b1cb7f4f737fd7e016caeb93451e534437e0374becedd
Ahmed Darrazi 9f74f7a658
Some checks failed
PR Fast Feedback / fast-feedback (pull_request) Failing after 51s
feat: compress governance operator outcomes
2026-04-19 14:15:11 +02:00

43 lines
1.3 KiB
Plaintext

import { entityKind } from "../../entity.js";
import { getColumnNameAndConfig } from "../../utils.js";
import { MySqlColumnBuilderWithAutoIncrement, MySqlColumnWithAutoIncrement } from "./common.js";
class MySqlDoubleBuilder extends MySqlColumnBuilderWithAutoIncrement {
static [entityKind] = "MySqlDoubleBuilder";
constructor(name, config) {
super(name, "number", "MySqlDouble");
this.config.precision = config?.precision;
this.config.scale = config?.scale;
this.config.unsigned = config?.unsigned;
}
/** @internal */
build(table) {
return new MySqlDouble(table, this.config);
}
}
class MySqlDouble extends MySqlColumnWithAutoIncrement {
static [entityKind] = "MySqlDouble";
precision = this.config.precision;
scale = this.config.scale;
unsigned = this.config.unsigned;
getSQLType() {
let type = "";
if (this.precision !== void 0 && this.scale !== void 0) {
type += `double(${this.precision},${this.scale})`;
} else if (this.precision === void 0) {
type += "double";
} else {
type += `double(${this.precision})`;
}
return this.unsigned ? `${type} unsigned` : type;
}
}
function double(a, b) {
const { name, config } = getColumnNameAndConfig(a, b);
return new MySqlDoubleBuilder(name, config);
}
export {
MySqlDouble,
MySqlDoubleBuilder,
double
};
//# sourceMappingURL=double.js.map