AK-21/Graphite-Industrial-Intelligence
0
1"use strict";2var __defProp = Object.defineProperty;3var __getOwnPropDesc = Object.getOwnPropertyDescriptor;4var __getOwnPropNames = Object.getOwnPropertyNames;5var __hasOwnProp = Object.prototype.hasOwnProperty;6var __export = (target, all) => {7 for (var name in all)8 __defProp(target, name, { get: all[name], enumerable: true });9};10var __copyProps = (to, from, except, desc) => {11 if (from && typeof from === "object" || typeof from === "function") {12 for (let key of __getOwnPropNames(from))13 if (!__hasOwnProp.call(to, key) && key !== except)14 __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });15 }16 return to;17};18var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);19var numeric_exports = {};20__export(numeric_exports, {21 SQLiteNumeric: () => SQLiteNumeric,22 SQLiteNumericBigInt: () => SQLiteNumericBigInt,23 SQLiteNumericBigIntBuilder: () => SQLiteNumericBigIntBuilder,24 SQLiteNumericBuilder: () => SQLiteNumericBuilder,25 SQLiteNumericNumber: () => SQLiteNumericNumber,26 SQLiteNumericNumberBuilder: () => SQLiteNumericNumberBuilder,27 numeric: () => numeric28});29module.exports = __toCommonJS(numeric_exports);30var import_entity = require("../../entity.cjs");31var import_utils = require("../../utils.cjs");32var import_common = require("./common.cjs");33class SQLiteNumericBuilder extends import_common.SQLiteColumnBuilder {34 static [import_entity.entityKind] = "SQLiteNumericBuilder";35 constructor(name) {36 super(name, "string", "SQLiteNumeric");37 }38 /** @internal */39 build(table) {40 return new SQLiteNumeric(41 table,42 this.config43 );44 }45}46class SQLiteNumeric extends import_common.SQLiteColumn {47 static [import_entity.entityKind] = "SQLiteNumeric";48 mapFromDriverValue(value) {49 if (typeof value === "string") return value;50 return String(value);51 }52 getSQLType() {53 return "numeric";54 }55}56class SQLiteNumericNumberBuilder extends import_common.SQLiteColumnBuilder {57 static [import_entity.entityKind] = "SQLiteNumericNumberBuilder";58 constructor(name) {59 super(name, "number", "SQLiteNumericNumber");60 }61 /** @internal */62 build(table) {63 return new SQLiteNumericNumber(64 table,65 this.config66 );67 }68}69class SQLiteNumericNumber extends import_common.SQLiteColumn {70 static [import_entity.entityKind] = "SQLiteNumericNumber";71 mapFromDriverValue(value) {72 if (typeof value === "number") return value;73 return Number(value);74 }75 mapToDriverValue = String;76 getSQLType() {77 return "numeric";78 }79}80class SQLiteNumericBigIntBuilder extends import_common.SQLiteColumnBuilder {81 static [import_entity.entityKind] = "SQLiteNumericBigIntBuilder";82 constructor(name) {83 super(name, "bigint", "SQLiteNumericBigInt");84 }85 /** @internal */86 build(table) {87 return new SQLiteNumericBigInt(88 table,89 this.config90 );91 }92}93class SQLiteNumericBigInt extends import_common.SQLiteColumn {94 static [import_entity.entityKind] = "SQLiteNumericBigInt";95 mapFromDriverValue = BigInt;96 mapToDriverValue = String;97 getSQLType() {98 return "numeric";99 }100}101function numeric(a, b) {102 const { name, config } = (0, import_utils.getColumnNameAndConfig)(a, b);103 const mode = config?.mode;104 return mode === "number" ? new SQLiteNumericNumberBuilder(name) : mode === "bigint" ? new SQLiteNumericBigIntBuilder(name) : new SQLiteNumericBuilder(name);105}106// Annotate the CommonJS export names for ESM import in node:1070 && (module.exports = {108 SQLiteNumeric,109 SQLiteNumericBigInt,110 SQLiteNumericBigIntBuilder,111 SQLiteNumericBuilder,112 SQLiteNumericNumber,113 SQLiteNumericNumberBuilder,114 numeric115});116//# sourceMappingURL=numeric.cjs.map