| Server IP : 159.203.156.69 / Your IP : 216.73.216.37 Web Server : nginx/1.24.0 System : Linux main-ubuntu 6.8.0-71-generic #71-Ubuntu SMP PREEMPT_DYNAMIC Tue Jul 22 16:52:38 UTC 2025 x86_64 User : root ( 0) PHP Version : 8.3.6 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /var/www/tanviranik.com/node_modules/drizzle-orm/sqlite-core/columns/ |
Upload File : |
import { entityKind } from "../../entity.js";
import { getColumnNameAndConfig } from "../../utils.js";
import { SQLiteColumn, SQLiteColumnBuilder } from "./common.js";
class SQLiteNumericBuilder extends SQLiteColumnBuilder {
static [entityKind] = "SQLiteNumericBuilder";
constructor(name) {
super(name, "string", "SQLiteNumeric");
}
/** @internal */
build(table) {
return new SQLiteNumeric(
table,
this.config
);
}
}
class SQLiteNumeric extends SQLiteColumn {
static [entityKind] = "SQLiteNumeric";
mapFromDriverValue(value) {
if (typeof value === "string") return value;
return String(value);
}
getSQLType() {
return "numeric";
}
}
class SQLiteNumericNumberBuilder extends SQLiteColumnBuilder {
static [entityKind] = "SQLiteNumericNumberBuilder";
constructor(name) {
super(name, "number", "SQLiteNumericNumber");
}
/** @internal */
build(table) {
return new SQLiteNumericNumber(
table,
this.config
);
}
}
class SQLiteNumericNumber extends SQLiteColumn {
static [entityKind] = "SQLiteNumericNumber";
mapFromDriverValue(value) {
if (typeof value === "number") return value;
return Number(value);
}
mapToDriverValue = String;
getSQLType() {
return "numeric";
}
}
class SQLiteNumericBigIntBuilder extends SQLiteColumnBuilder {
static [entityKind] = "SQLiteNumericBigIntBuilder";
constructor(name) {
super(name, "bigint", "SQLiteNumericBigInt");
}
/** @internal */
build(table) {
return new SQLiteNumericBigInt(
table,
this.config
);
}
}
class SQLiteNumericBigInt extends SQLiteColumn {
static [entityKind] = "SQLiteNumericBigInt";
mapFromDriverValue = BigInt;
mapToDriverValue = String;
getSQLType() {
return "numeric";
}
}
function numeric(a, b) {
const { name, config } = getColumnNameAndConfig(a, b);
const mode = config?.mode;
return mode === "number" ? new SQLiteNumericNumberBuilder(name) : mode === "bigint" ? new SQLiteNumericBigIntBuilder(name) : new SQLiteNumericBuilder(name);
}
export {
SQLiteNumeric,
SQLiteNumericBigInt,
SQLiteNumericBigIntBuilder,
SQLiteNumericBuilder,
SQLiteNumericNumber,
SQLiteNumericNumberBuilder,
numeric
};
//# sourceMappingURL=numeric.js.map