drizzle-orm 1.0.0-beta.1-fd5d1e8 → 1.0.0-beta.1-867d080
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/mysql-core/columns/decimal.cjs +86 -1
- package/mysql-core/columns/decimal.cjs.map +1 -1
- package/mysql-core/columns/decimal.d.cts +47 -3
- package/mysql-core/columns/decimal.d.ts +47 -3
- package/mysql-core/columns/decimal.js +82 -1
- package/mysql-core/columns/decimal.js.map +1 -1
- package/mysql-core/dialect.cjs +3 -0
- package/mysql-core/dialect.cjs.map +1 -1
- package/mysql-core/dialect.js +3 -0
- package/mysql-core/dialect.js.map +1 -1
- package/neon-serverless/session.cjs +6 -0
- package/neon-serverless/session.cjs.map +1 -1
- package/neon-serverless/session.js +6 -0
- package/neon-serverless/session.js.map +1 -1
- package/node-postgres/session.cjs +6 -0
- package/node-postgres/session.cjs.map +1 -1
- package/node-postgres/session.js +6 -0
- package/node-postgres/session.js.map +1 -1
- package/package.json +1 -1
- package/pg-core/columns/numeric.cjs +86 -1
- package/pg-core/columns/numeric.cjs.map +1 -1
- package/pg-core/columns/numeric.d.cts +61 -6
- package/pg-core/columns/numeric.d.ts +61 -6
- package/pg-core/columns/numeric.js +82 -1
- package/pg-core/columns/numeric.js.map +1 -1
- package/pg-core/dialect.cjs +2 -0
- package/pg-core/dialect.cjs.map +1 -1
- package/pg-core/dialect.js +2 -0
- package/pg-core/dialect.js.map +1 -1
- package/pglite/session.cjs +8 -0
- package/pglite/session.cjs.map +1 -1
- package/pglite/session.js +8 -0
- package/pglite/session.js.map +1 -1
- package/postgres-js/driver.cjs +1 -1
- package/postgres-js/driver.cjs.map +1 -1
- package/postgres-js/driver.js +1 -1
- package/postgres-js/driver.js.map +1 -1
- package/postgres-js/session.cjs +0 -1
- package/postgres-js/session.cjs.map +1 -1
- package/postgres-js/session.d.cts +0 -1
- package/postgres-js/session.d.ts +0 -1
- package/postgres-js/session.js +0 -1
- package/postgres-js/session.js.map +1 -1
- package/relations.cjs +0 -2
- package/relations.cjs.map +1 -1
- package/relations.d.cts +3 -3
- package/relations.d.ts +3 -3
- package/relations.js +0 -2
- package/relations.js.map +1 -1
- package/sqlite-core/columns/numeric.cjs +64 -2
- package/sqlite-core/columns/numeric.cjs.map +1 -1
- package/sqlite-core/columns/numeric.d.cts +43 -2
- package/sqlite-core/columns/numeric.d.ts +43 -2
- package/sqlite-core/columns/numeric.js +60 -2
- package/sqlite-core/columns/numeric.js.map +1 -1
- package/sqlite-core/dialect.cjs +5 -0
- package/sqlite-core/dialect.cjs.map +1 -1
- package/sqlite-core/dialect.js +5 -0
- package/sqlite-core/dialect.js.map +1 -1
- package/vercel-postgres/session.cjs +6 -0
- package/vercel-postgres/session.cjs.map +1 -1
- package/vercel-postgres/session.js +6 -0
- package/vercel-postgres/session.js.map +1 -1
- package/version.cjs +1 -1
- package/version.d.cts +1 -1
- package/version.d.ts +1 -1
- package/version.js +1 -1
|
@@ -19,7 +19,11 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
19
19
|
var decimal_exports = {};
|
|
20
20
|
__export(decimal_exports, {
|
|
21
21
|
MySqlDecimal: () => MySqlDecimal,
|
|
22
|
+
MySqlDecimalBigInt: () => MySqlDecimalBigInt,
|
|
23
|
+
MySqlDecimalBigIntBuilder: () => MySqlDecimalBigIntBuilder,
|
|
22
24
|
MySqlDecimalBuilder: () => MySqlDecimalBuilder,
|
|
25
|
+
MySqlDecimalNumber: () => MySqlDecimalNumber,
|
|
26
|
+
MySqlDecimalNumberBuilder: () => MySqlDecimalNumberBuilder,
|
|
23
27
|
decimal: () => decimal
|
|
24
28
|
});
|
|
25
29
|
module.exports = __toCommonJS(decimal_exports);
|
|
@@ -65,14 +69,95 @@ class MySqlDecimal extends import_common.MySqlColumnWithAutoIncrement {
|
|
|
65
69
|
return this.unsigned ? `${type} unsigned` : type;
|
|
66
70
|
}
|
|
67
71
|
}
|
|
72
|
+
class MySqlDecimalNumberBuilder extends import_common.MySqlColumnBuilderWithAutoIncrement {
|
|
73
|
+
static [import_entity.entityKind] = "MySqlDecimalNumberBuilder";
|
|
74
|
+
constructor(name, config) {
|
|
75
|
+
super(name, "number", "MySqlDecimalNumber");
|
|
76
|
+
this.config.precision = config?.precision;
|
|
77
|
+
this.config.scale = config?.scale;
|
|
78
|
+
this.config.unsigned = config?.unsigned;
|
|
79
|
+
}
|
|
80
|
+
/** @internal */
|
|
81
|
+
build(table) {
|
|
82
|
+
return new MySqlDecimalNumber(
|
|
83
|
+
table,
|
|
84
|
+
this.config
|
|
85
|
+
);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
class MySqlDecimalNumber extends import_common.MySqlColumnWithAutoIncrement {
|
|
89
|
+
static [import_entity.entityKind] = "MySqlDecimalNumber";
|
|
90
|
+
precision = this.config.precision;
|
|
91
|
+
scale = this.config.scale;
|
|
92
|
+
unsigned = this.config.unsigned;
|
|
93
|
+
mapFromDriverValue(value) {
|
|
94
|
+
if (typeof value === "number")
|
|
95
|
+
return value;
|
|
96
|
+
return Number(value);
|
|
97
|
+
}
|
|
98
|
+
mapToDriverValue = String;
|
|
99
|
+
getSQLType() {
|
|
100
|
+
let type = "";
|
|
101
|
+
if (this.precision !== void 0 && this.scale !== void 0) {
|
|
102
|
+
type += `decimal(${this.precision},${this.scale})`;
|
|
103
|
+
} else if (this.precision === void 0) {
|
|
104
|
+
type += "decimal";
|
|
105
|
+
} else {
|
|
106
|
+
type += `decimal(${this.precision})`;
|
|
107
|
+
}
|
|
108
|
+
type = type === "decimal(10,0)" || type === "decimal(10)" ? "decimal" : type;
|
|
109
|
+
return this.unsigned ? `${type} unsigned` : type;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
class MySqlDecimalBigIntBuilder extends import_common.MySqlColumnBuilderWithAutoIncrement {
|
|
113
|
+
static [import_entity.entityKind] = "MySqlDecimalBigIntBuilder";
|
|
114
|
+
constructor(name, config) {
|
|
115
|
+
super(name, "bigint", "MySqlDecimalBigInt");
|
|
116
|
+
this.config.precision = config?.precision;
|
|
117
|
+
this.config.scale = config?.scale;
|
|
118
|
+
this.config.unsigned = config?.unsigned;
|
|
119
|
+
}
|
|
120
|
+
/** @internal */
|
|
121
|
+
build(table) {
|
|
122
|
+
return new MySqlDecimalBigInt(
|
|
123
|
+
table,
|
|
124
|
+
this.config
|
|
125
|
+
);
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
class MySqlDecimalBigInt extends import_common.MySqlColumnWithAutoIncrement {
|
|
129
|
+
static [import_entity.entityKind] = "MySqlDecimalBigInt";
|
|
130
|
+
precision = this.config.precision;
|
|
131
|
+
scale = this.config.scale;
|
|
132
|
+
unsigned = this.config.unsigned;
|
|
133
|
+
mapFromDriverValue = BigInt;
|
|
134
|
+
mapToDriverValue = String;
|
|
135
|
+
getSQLType() {
|
|
136
|
+
let type = "";
|
|
137
|
+
if (this.precision !== void 0 && this.scale !== void 0) {
|
|
138
|
+
type += `decimal(${this.precision},${this.scale})`;
|
|
139
|
+
} else if (this.precision === void 0) {
|
|
140
|
+
type += "decimal";
|
|
141
|
+
} else {
|
|
142
|
+
type += `decimal(${this.precision})`;
|
|
143
|
+
}
|
|
144
|
+
type = type === "decimal(10,0)" || type === "decimal(10)" ? "decimal" : type;
|
|
145
|
+
return this.unsigned ? `${type} unsigned` : type;
|
|
146
|
+
}
|
|
147
|
+
}
|
|
68
148
|
function decimal(a, b = {}) {
|
|
69
149
|
const { name, config } = (0, import_utils.getColumnNameAndConfig)(a, b);
|
|
70
|
-
|
|
150
|
+
const mode = config?.mode;
|
|
151
|
+
return mode === "number" ? new MySqlDecimalNumberBuilder(name, config) : mode === "bigint" ? new MySqlDecimalBigIntBuilder(name, config) : new MySqlDecimalBuilder(name, config);
|
|
71
152
|
}
|
|
72
153
|
// Annotate the CommonJS export names for ESM import in node:
|
|
73
154
|
0 && (module.exports = {
|
|
74
155
|
MySqlDecimal,
|
|
156
|
+
MySqlDecimalBigInt,
|
|
157
|
+
MySqlDecimalBigIntBuilder,
|
|
75
158
|
MySqlDecimalBuilder,
|
|
159
|
+
MySqlDecimalNumber,
|
|
160
|
+
MySqlDecimalNumberBuilder,
|
|
76
161
|
decimal
|
|
77
162
|
});
|
|
78
163
|
//# sourceMappingURL=decimal.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/mysql-core/columns/decimal.ts"],"sourcesContent":["import type { ColumnBuilderBaseConfig, ColumnBuilderRuntimeConfig, MakeColumnConfig } from '~/column-builder.ts';\nimport type { ColumnBaseConfig } from '~/column.ts';\nimport { entityKind } from '~/entity.ts';\nimport type { AnyMySqlTable } from '~/mysql-core/table.ts';\nimport { getColumnNameAndConfig } from '~/utils.ts';\nimport { MySqlColumnBuilderWithAutoIncrement, MySqlColumnWithAutoIncrement } from './common.ts';\n\nexport type MySqlDecimalBuilderInitial<TName extends string> = MySqlDecimalBuilder<{\n\tname: TName;\n\tdataType: 'string';\n\tcolumnType: 'MySqlDecimal';\n\tdata: string;\n\tdriverParam: string;\n\tenumValues: undefined;\n}>;\n\nexport class MySqlDecimalBuilder<\n\tT extends ColumnBuilderBaseConfig<'string', 'MySqlDecimal'>,\n> extends MySqlColumnBuilderWithAutoIncrement<T, MySqlDecimalConfig> {\n\tstatic override readonly [entityKind]: string = 'MySqlDecimalBuilder';\n\n\tconstructor(name: T['name'], config: MySqlDecimalConfig | undefined) {\n\t\tsuper(name, 'string', 'MySqlDecimal');\n\t\tthis.config.precision = config?.precision;\n\t\tthis.config.scale = config?.scale;\n\t\tthis.config.unsigned = config?.unsigned;\n\t}\n\n\t/** @internal */\n\toverride build<TTableName extends string>(\n\t\ttable: AnyMySqlTable<{ name: TTableName }>,\n\t): MySqlDecimal<MakeColumnConfig<T, TTableName>> {\n\t\treturn new MySqlDecimal<MakeColumnConfig<T, TTableName>>(\n\t\t\ttable,\n\t\t\tthis.config as ColumnBuilderRuntimeConfig<any, any>,\n\t\t);\n\t}\n}\n\nexport class MySqlDecimal<T extends ColumnBaseConfig<'string', 'MySqlDecimal'>>\n\textends MySqlColumnWithAutoIncrement<T, MySqlDecimalConfig>\n{\n\tstatic override readonly [entityKind]: string = 'MySqlDecimal';\n\n\treadonly precision: number | undefined = this.config.precision;\n\treadonly scale: number | undefined = this.config.scale;\n\treadonly unsigned: boolean | undefined = this.config.unsigned;\n\n\toverride mapFromDriverValue(value: unknown): string {\n\t\t// For RQBv2\n\t\tif (typeof value === 'string') return value;\n\n\t\treturn String(value);\n\t}\n\n\tgetSQLType(): string {\n\t\tlet type = '';\n\t\tif (this.precision !== undefined && this.scale !== undefined) {\n\t\t\ttype += `decimal(${this.precision},${this.scale})`;\n\t\t} else if (this.precision === undefined) {\n\t\t\ttype += 'decimal';\n\t\t} else {\n\t\t\ttype += `decimal(${this.precision})`;\n\t\t}\n\t\ttype = type === 'decimal(10,0)' || type === 'decimal(10)' ? 'decimal' : type;\n\t\treturn this.unsigned ? `${type} unsigned` : type;\n\t}\n}\n\nexport interface MySqlDecimalConfig {\n\tprecision?: number;\n\tscale?: number;\n\tunsigned?: boolean;\n}\n\nexport function decimal(): MySqlDecimalBuilderInitial<''>;\nexport function decimal(\n\tconfig: MySqlDecimalConfig,\n): MySqlDecimalBuilderInitial<''>;\nexport function decimal<TName extends string>(\n\tname: TName,\n\tconfig?: MySqlDecimalConfig,\n): MySqlDecimalBuilderInitial<TName>;\nexport function decimal(a?: string | MySqlDecimalConfig, b: MySqlDecimalConfig = {}) {\n\tconst { name, config } = getColumnNameAndConfig<MySqlDecimalConfig>(a, b);\n\treturn new MySqlDecimalBuilder(name, config);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,oBAA2B;AAE3B,mBAAuC;AACvC,oBAAkF;AAW3E,MAAM,4BAEH,kDAA2D;AAAA,EACpE,QAA0B,wBAAU,IAAY;AAAA,EAEhD,YAAY,MAAiB,QAAwC;AACpE,UAAM,MAAM,UAAU,cAAc;AACpC,SAAK,OAAO,YAAY,QAAQ;AAChC,SAAK,OAAO,QAAQ,QAAQ;AAC5B,SAAK,OAAO,WAAW,QAAQ;AAAA,EAChC;AAAA;AAAA,EAGS,MACR,OACgD;AAChD,WAAO,IAAI;AAAA,MACV;AAAA,MACA,KAAK;AAAA,IACN;AAAA,EACD;AACD;AAEO,MAAM,qBACJ,2CACT;AAAA,EACC,QAA0B,wBAAU,IAAY;AAAA,EAEvC,YAAgC,KAAK,OAAO;AAAA,EAC5C,QAA4B,KAAK,OAAO;AAAA,EACxC,WAAgC,KAAK,OAAO;AAAA,EAE5C,mBAAmB,OAAwB;AAEnD,QAAI,OAAO,UAAU;AAAU,aAAO;AAEtC,WAAO,OAAO,KAAK;AAAA,EACpB;AAAA,EAEA,aAAqB;AACpB,QAAI,OAAO;AACX,QAAI,KAAK,cAAc,UAAa,KAAK,UAAU,QAAW;AAC7D,cAAQ,WAAW,KAAK,SAAS,IAAI,KAAK,KAAK;AAAA,IAChD,WAAW,KAAK,cAAc,QAAW;AACxC,cAAQ;AAAA,IACT,OAAO;AACN,cAAQ,WAAW,KAAK,SAAS;AAAA,IAClC;AACA,WAAO,SAAS,mBAAmB,SAAS,gBAAgB,YAAY;AACxE,WAAO,KAAK,WAAW,GAAG,IAAI,cAAc;AAAA,EAC7C;AACD;AAgBO,SAAS,QAAQ,GAAiC,IAAwB,CAAC,GAAG;AACpF,QAAM,EAAE,MAAM,OAAO,QAAI,qCAA2C,GAAG,CAAC;AACxE,SAAO,IAAI,oBAAoB,MAAM,MAAM;AAC5C;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../../src/mysql-core/columns/decimal.ts"],"sourcesContent":["import type { ColumnBuilderBaseConfig, ColumnBuilderRuntimeConfig, MakeColumnConfig } from '~/column-builder.ts';\nimport type { ColumnBaseConfig } from '~/column.ts';\nimport { entityKind } from '~/entity.ts';\nimport type { AnyMySqlTable } from '~/mysql-core/table.ts';\nimport { type Equal, getColumnNameAndConfig } from '~/utils.ts';\nimport { MySqlColumnBuilderWithAutoIncrement, MySqlColumnWithAutoIncrement } from './common.ts';\n\nexport type MySqlDecimalBuilderInitial<TName extends string> = MySqlDecimalBuilder<{\n\tname: TName;\n\tdataType: 'string';\n\tcolumnType: 'MySqlDecimal';\n\tdata: string;\n\tdriverParam: string;\n\tenumValues: undefined;\n}>;\n\nexport class MySqlDecimalBuilder<\n\tT extends ColumnBuilderBaseConfig<'string', 'MySqlDecimal'>,\n> extends MySqlColumnBuilderWithAutoIncrement<T, MySqlDecimalConfig> {\n\tstatic override readonly [entityKind]: string = 'MySqlDecimalBuilder';\n\n\tconstructor(name: T['name'], config: MySqlDecimalConfig | undefined) {\n\t\tsuper(name, 'string', 'MySqlDecimal');\n\t\tthis.config.precision = config?.precision;\n\t\tthis.config.scale = config?.scale;\n\t\tthis.config.unsigned = config?.unsigned;\n\t}\n\n\t/** @internal */\n\toverride build<TTableName extends string>(\n\t\ttable: AnyMySqlTable<{ name: TTableName }>,\n\t): MySqlDecimal<MakeColumnConfig<T, TTableName>> {\n\t\treturn new MySqlDecimal<MakeColumnConfig<T, TTableName>>(\n\t\t\ttable,\n\t\t\tthis.config as ColumnBuilderRuntimeConfig<any, any>,\n\t\t);\n\t}\n}\n\nexport class MySqlDecimal<T extends ColumnBaseConfig<'string', 'MySqlDecimal'>>\n\textends MySqlColumnWithAutoIncrement<T, MySqlDecimalConfig>\n{\n\tstatic override readonly [entityKind]: string = 'MySqlDecimal';\n\n\treadonly precision: number | undefined = this.config.precision;\n\treadonly scale: number | undefined = this.config.scale;\n\treadonly unsigned: boolean | undefined = this.config.unsigned;\n\n\toverride mapFromDriverValue(value: unknown): string {\n\t\t// For RQBv2\n\t\tif (typeof value === 'string') return value;\n\n\t\treturn String(value);\n\t}\n\n\tgetSQLType(): string {\n\t\tlet type = '';\n\t\tif (this.precision !== undefined && this.scale !== undefined) {\n\t\t\ttype += `decimal(${this.precision},${this.scale})`;\n\t\t} else if (this.precision === undefined) {\n\t\t\ttype += 'decimal';\n\t\t} else {\n\t\t\ttype += `decimal(${this.precision})`;\n\t\t}\n\t\ttype = type === 'decimal(10,0)' || type === 'decimal(10)' ? 'decimal' : type;\n\t\treturn this.unsigned ? `${type} unsigned` : type;\n\t}\n}\n\nexport type MySqlDecimalNumberBuilderInitial<TName extends string> = MySqlDecimalNumberBuilder<{\n\tname: TName;\n\tdataType: 'number';\n\tcolumnType: 'MySqlDecimalNumber';\n\tdata: number;\n\tdriverParam: string;\n\tenumValues: undefined;\n}>;\n\nexport class MySqlDecimalNumberBuilder<\n\tT extends ColumnBuilderBaseConfig<'number', 'MySqlDecimalNumber'>,\n> extends MySqlColumnBuilderWithAutoIncrement<T, MySqlDecimalConfig> {\n\tstatic override readonly [entityKind]: string = 'MySqlDecimalNumberBuilder';\n\n\tconstructor(name: T['name'], config: MySqlDecimalConfig | undefined) {\n\t\tsuper(name, 'number', 'MySqlDecimalNumber');\n\t\tthis.config.precision = config?.precision;\n\t\tthis.config.scale = config?.scale;\n\t\tthis.config.unsigned = config?.unsigned;\n\t}\n\n\t/** @internal */\n\toverride build<TTableName extends string>(\n\t\ttable: AnyMySqlTable<{ name: TTableName }>,\n\t): MySqlDecimalNumber<MakeColumnConfig<T, TTableName>> {\n\t\treturn new MySqlDecimalNumber<MakeColumnConfig<T, TTableName>>(\n\t\t\ttable,\n\t\t\tthis.config as ColumnBuilderRuntimeConfig<any, any>,\n\t\t);\n\t}\n}\n\nexport class MySqlDecimalNumber<T extends ColumnBaseConfig<'number', 'MySqlDecimalNumber'>>\n\textends MySqlColumnWithAutoIncrement<T, MySqlDecimalConfig>\n{\n\tstatic override readonly [entityKind]: string = 'MySqlDecimalNumber';\n\n\treadonly precision: number | undefined = this.config.precision;\n\treadonly scale: number | undefined = this.config.scale;\n\treadonly unsigned: boolean | undefined = this.config.unsigned;\n\n\toverride mapFromDriverValue(value: unknown): number {\n\t\tif (typeof value === 'number') return value;\n\n\t\treturn Number(value);\n\t}\n\n\toverride mapToDriverValue = String;\n\n\tgetSQLType(): string {\n\t\tlet type = '';\n\t\tif (this.precision !== undefined && this.scale !== undefined) {\n\t\t\ttype += `decimal(${this.precision},${this.scale})`;\n\t\t} else if (this.precision === undefined) {\n\t\t\ttype += 'decimal';\n\t\t} else {\n\t\t\ttype += `decimal(${this.precision})`;\n\t\t}\n\t\ttype = type === 'decimal(10,0)' || type === 'decimal(10)' ? 'decimal' : type;\n\t\treturn this.unsigned ? `${type} unsigned` : type;\n\t}\n}\n\nexport type MySqlDecimalBigIntBuilderInitial<TName extends string> = MySqlDecimalBigIntBuilder<{\n\tname: TName;\n\tdataType: 'bigint';\n\tcolumnType: 'MySqlDecimalBigInt';\n\tdata: bigint;\n\tdriverParam: string;\n\tenumValues: undefined;\n}>;\n\nexport class MySqlDecimalBigIntBuilder<\n\tT extends ColumnBuilderBaseConfig<'bigint', 'MySqlDecimalBigInt'>,\n> extends MySqlColumnBuilderWithAutoIncrement<T, MySqlDecimalConfig> {\n\tstatic override readonly [entityKind]: string = 'MySqlDecimalBigIntBuilder';\n\n\tconstructor(name: T['name'], config: MySqlDecimalConfig | undefined) {\n\t\tsuper(name, 'bigint', 'MySqlDecimalBigInt');\n\t\tthis.config.precision = config?.precision;\n\t\tthis.config.scale = config?.scale;\n\t\tthis.config.unsigned = config?.unsigned;\n\t}\n\n\t/** @internal */\n\toverride build<TTableName extends string>(\n\t\ttable: AnyMySqlTable<{ name: TTableName }>,\n\t): MySqlDecimalBigInt<MakeColumnConfig<T, TTableName>> {\n\t\treturn new MySqlDecimalBigInt<MakeColumnConfig<T, TTableName>>(\n\t\t\ttable,\n\t\t\tthis.config as ColumnBuilderRuntimeConfig<any, any>,\n\t\t);\n\t}\n}\n\nexport class MySqlDecimalBigInt<T extends ColumnBaseConfig<'bigint', 'MySqlDecimalBigInt'>>\n\textends MySqlColumnWithAutoIncrement<T, MySqlDecimalConfig>\n{\n\tstatic override readonly [entityKind]: string = 'MySqlDecimalBigInt';\n\n\treadonly precision: number | undefined = this.config.precision;\n\treadonly scale: number | undefined = this.config.scale;\n\treadonly unsigned: boolean | undefined = this.config.unsigned;\n\n\toverride mapFromDriverValue = BigInt;\n\n\toverride mapToDriverValue = String;\n\n\tgetSQLType(): string {\n\t\tlet type = '';\n\t\tif (this.precision !== undefined && this.scale !== undefined) {\n\t\t\ttype += `decimal(${this.precision},${this.scale})`;\n\t\t} else if (this.precision === undefined) {\n\t\t\ttype += 'decimal';\n\t\t} else {\n\t\t\ttype += `decimal(${this.precision})`;\n\t\t}\n\t\ttype = type === 'decimal(10,0)' || type === 'decimal(10)' ? 'decimal' : type;\n\t\treturn this.unsigned ? `${type} unsigned` : type;\n\t}\n}\n\nexport interface MySqlDecimalConfig<T extends 'string' | 'number' | 'bigint' = 'string' | 'number' | 'bigint'> {\n\tprecision?: number;\n\tscale?: number;\n\tunsigned?: boolean;\n\tmode?: T;\n}\n\nexport function decimal(): MySqlDecimalBuilderInitial<''>;\nexport function decimal<TMode extends 'string' | 'number' | 'bigint'>(\n\tconfig: MySqlDecimalConfig<TMode>,\n): Equal<TMode, 'number'> extends true ? MySqlDecimalNumberBuilderInitial<''>\n\t: Equal<TMode, 'bigint'> extends true ? MySqlDecimalBigIntBuilderInitial<''>\n\t: MySqlDecimalBuilderInitial<''>;\nexport function decimal<TName extends string, TMode extends 'string' | 'number' | 'bigint'>(\n\tname: TName,\n\tconfig?: MySqlDecimalConfig<TMode>,\n): Equal<TMode, 'number'> extends true ? MySqlDecimalNumberBuilderInitial<TName>\n\t: Equal<TMode, 'bigint'> extends true ? MySqlDecimalBigIntBuilderInitial<TName>\n\t: MySqlDecimalBuilderInitial<TName>;\nexport function decimal(a?: string | MySqlDecimalConfig, b: MySqlDecimalConfig = {}) {\n\tconst { name, config } = getColumnNameAndConfig<MySqlDecimalConfig>(a, b);\n\tconst mode = config?.mode;\n\treturn mode === 'number'\n\t\t? new MySqlDecimalNumberBuilder(name, config)\n\t\t: mode === 'bigint'\n\t\t? new MySqlDecimalBigIntBuilder(name, config)\n\t\t: new MySqlDecimalBuilder(name, config);\n}\n"],"mappings":"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","names":[]}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { ColumnBuilderBaseConfig } from "../../column-builder.cjs";
|
|
2
2
|
import type { ColumnBaseConfig } from "../../column.cjs";
|
|
3
3
|
import { entityKind } from "../../entity.cjs";
|
|
4
|
+
import { type Equal } from "../../utils.cjs";
|
|
4
5
|
import { MySqlColumnBuilderWithAutoIncrement, MySqlColumnWithAutoIncrement } from "./common.cjs";
|
|
5
6
|
export type MySqlDecimalBuilderInitial<TName extends string> = MySqlDecimalBuilder<{
|
|
6
7
|
name: TName;
|
|
@@ -22,11 +23,54 @@ export declare class MySqlDecimal<T extends ColumnBaseConfig<'string', 'MySqlDec
|
|
|
22
23
|
mapFromDriverValue(value: unknown): string;
|
|
23
24
|
getSQLType(): string;
|
|
24
25
|
}
|
|
25
|
-
export
|
|
26
|
+
export type MySqlDecimalNumberBuilderInitial<TName extends string> = MySqlDecimalNumberBuilder<{
|
|
27
|
+
name: TName;
|
|
28
|
+
dataType: 'number';
|
|
29
|
+
columnType: 'MySqlDecimalNumber';
|
|
30
|
+
data: number;
|
|
31
|
+
driverParam: string;
|
|
32
|
+
enumValues: undefined;
|
|
33
|
+
}>;
|
|
34
|
+
export declare class MySqlDecimalNumberBuilder<T extends ColumnBuilderBaseConfig<'number', 'MySqlDecimalNumber'>> extends MySqlColumnBuilderWithAutoIncrement<T, MySqlDecimalConfig> {
|
|
35
|
+
static readonly [entityKind]: string;
|
|
36
|
+
constructor(name: T['name'], config: MySqlDecimalConfig | undefined);
|
|
37
|
+
}
|
|
38
|
+
export declare class MySqlDecimalNumber<T extends ColumnBaseConfig<'number', 'MySqlDecimalNumber'>> extends MySqlColumnWithAutoIncrement<T, MySqlDecimalConfig> {
|
|
39
|
+
static readonly [entityKind]: string;
|
|
40
|
+
readonly precision: number | undefined;
|
|
41
|
+
readonly scale: number | undefined;
|
|
42
|
+
readonly unsigned: boolean | undefined;
|
|
43
|
+
mapFromDriverValue(value: unknown): number;
|
|
44
|
+
mapToDriverValue: StringConstructor;
|
|
45
|
+
getSQLType(): string;
|
|
46
|
+
}
|
|
47
|
+
export type MySqlDecimalBigIntBuilderInitial<TName extends string> = MySqlDecimalBigIntBuilder<{
|
|
48
|
+
name: TName;
|
|
49
|
+
dataType: 'bigint';
|
|
50
|
+
columnType: 'MySqlDecimalBigInt';
|
|
51
|
+
data: bigint;
|
|
52
|
+
driverParam: string;
|
|
53
|
+
enumValues: undefined;
|
|
54
|
+
}>;
|
|
55
|
+
export declare class MySqlDecimalBigIntBuilder<T extends ColumnBuilderBaseConfig<'bigint', 'MySqlDecimalBigInt'>> extends MySqlColumnBuilderWithAutoIncrement<T, MySqlDecimalConfig> {
|
|
56
|
+
static readonly [entityKind]: string;
|
|
57
|
+
constructor(name: T['name'], config: MySqlDecimalConfig | undefined);
|
|
58
|
+
}
|
|
59
|
+
export declare class MySqlDecimalBigInt<T extends ColumnBaseConfig<'bigint', 'MySqlDecimalBigInt'>> extends MySqlColumnWithAutoIncrement<T, MySqlDecimalConfig> {
|
|
60
|
+
static readonly [entityKind]: string;
|
|
61
|
+
readonly precision: number | undefined;
|
|
62
|
+
readonly scale: number | undefined;
|
|
63
|
+
readonly unsigned: boolean | undefined;
|
|
64
|
+
mapFromDriverValue: BigIntConstructor;
|
|
65
|
+
mapToDriverValue: StringConstructor;
|
|
66
|
+
getSQLType(): string;
|
|
67
|
+
}
|
|
68
|
+
export interface MySqlDecimalConfig<T extends 'string' | 'number' | 'bigint' = 'string' | 'number' | 'bigint'> {
|
|
26
69
|
precision?: number;
|
|
27
70
|
scale?: number;
|
|
28
71
|
unsigned?: boolean;
|
|
72
|
+
mode?: T;
|
|
29
73
|
}
|
|
30
74
|
export declare function decimal(): MySqlDecimalBuilderInitial<''>;
|
|
31
|
-
export declare function decimal(config: MySqlDecimalConfig): MySqlDecimalBuilderInitial<''>;
|
|
32
|
-
export declare function decimal<TName extends string>(name: TName, config?: MySqlDecimalConfig): MySqlDecimalBuilderInitial<TName>;
|
|
75
|
+
export declare function decimal<TMode extends 'string' | 'number' | 'bigint'>(config: MySqlDecimalConfig<TMode>): Equal<TMode, 'number'> extends true ? MySqlDecimalNumberBuilderInitial<''> : Equal<TMode, 'bigint'> extends true ? MySqlDecimalBigIntBuilderInitial<''> : MySqlDecimalBuilderInitial<''>;
|
|
76
|
+
export declare function decimal<TName extends string, TMode extends 'string' | 'number' | 'bigint'>(name: TName, config?: MySqlDecimalConfig<TMode>): Equal<TMode, 'number'> extends true ? MySqlDecimalNumberBuilderInitial<TName> : Equal<TMode, 'bigint'> extends true ? MySqlDecimalBigIntBuilderInitial<TName> : MySqlDecimalBuilderInitial<TName>;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { ColumnBuilderBaseConfig } from "../../column-builder.js";
|
|
2
2
|
import type { ColumnBaseConfig } from "../../column.js";
|
|
3
3
|
import { entityKind } from "../../entity.js";
|
|
4
|
+
import { type Equal } from "../../utils.js";
|
|
4
5
|
import { MySqlColumnBuilderWithAutoIncrement, MySqlColumnWithAutoIncrement } from "./common.js";
|
|
5
6
|
export type MySqlDecimalBuilderInitial<TName extends string> = MySqlDecimalBuilder<{
|
|
6
7
|
name: TName;
|
|
@@ -22,11 +23,54 @@ export declare class MySqlDecimal<T extends ColumnBaseConfig<'string', 'MySqlDec
|
|
|
22
23
|
mapFromDriverValue(value: unknown): string;
|
|
23
24
|
getSQLType(): string;
|
|
24
25
|
}
|
|
25
|
-
export
|
|
26
|
+
export type MySqlDecimalNumberBuilderInitial<TName extends string> = MySqlDecimalNumberBuilder<{
|
|
27
|
+
name: TName;
|
|
28
|
+
dataType: 'number';
|
|
29
|
+
columnType: 'MySqlDecimalNumber';
|
|
30
|
+
data: number;
|
|
31
|
+
driverParam: string;
|
|
32
|
+
enumValues: undefined;
|
|
33
|
+
}>;
|
|
34
|
+
export declare class MySqlDecimalNumberBuilder<T extends ColumnBuilderBaseConfig<'number', 'MySqlDecimalNumber'>> extends MySqlColumnBuilderWithAutoIncrement<T, MySqlDecimalConfig> {
|
|
35
|
+
static readonly [entityKind]: string;
|
|
36
|
+
constructor(name: T['name'], config: MySqlDecimalConfig | undefined);
|
|
37
|
+
}
|
|
38
|
+
export declare class MySqlDecimalNumber<T extends ColumnBaseConfig<'number', 'MySqlDecimalNumber'>> extends MySqlColumnWithAutoIncrement<T, MySqlDecimalConfig> {
|
|
39
|
+
static readonly [entityKind]: string;
|
|
40
|
+
readonly precision: number | undefined;
|
|
41
|
+
readonly scale: number | undefined;
|
|
42
|
+
readonly unsigned: boolean | undefined;
|
|
43
|
+
mapFromDriverValue(value: unknown): number;
|
|
44
|
+
mapToDriverValue: StringConstructor;
|
|
45
|
+
getSQLType(): string;
|
|
46
|
+
}
|
|
47
|
+
export type MySqlDecimalBigIntBuilderInitial<TName extends string> = MySqlDecimalBigIntBuilder<{
|
|
48
|
+
name: TName;
|
|
49
|
+
dataType: 'bigint';
|
|
50
|
+
columnType: 'MySqlDecimalBigInt';
|
|
51
|
+
data: bigint;
|
|
52
|
+
driverParam: string;
|
|
53
|
+
enumValues: undefined;
|
|
54
|
+
}>;
|
|
55
|
+
export declare class MySqlDecimalBigIntBuilder<T extends ColumnBuilderBaseConfig<'bigint', 'MySqlDecimalBigInt'>> extends MySqlColumnBuilderWithAutoIncrement<T, MySqlDecimalConfig> {
|
|
56
|
+
static readonly [entityKind]: string;
|
|
57
|
+
constructor(name: T['name'], config: MySqlDecimalConfig | undefined);
|
|
58
|
+
}
|
|
59
|
+
export declare class MySqlDecimalBigInt<T extends ColumnBaseConfig<'bigint', 'MySqlDecimalBigInt'>> extends MySqlColumnWithAutoIncrement<T, MySqlDecimalConfig> {
|
|
60
|
+
static readonly [entityKind]: string;
|
|
61
|
+
readonly precision: number | undefined;
|
|
62
|
+
readonly scale: number | undefined;
|
|
63
|
+
readonly unsigned: boolean | undefined;
|
|
64
|
+
mapFromDriverValue: BigIntConstructor;
|
|
65
|
+
mapToDriverValue: StringConstructor;
|
|
66
|
+
getSQLType(): string;
|
|
67
|
+
}
|
|
68
|
+
export interface MySqlDecimalConfig<T extends 'string' | 'number' | 'bigint' = 'string' | 'number' | 'bigint'> {
|
|
26
69
|
precision?: number;
|
|
27
70
|
scale?: number;
|
|
28
71
|
unsigned?: boolean;
|
|
72
|
+
mode?: T;
|
|
29
73
|
}
|
|
30
74
|
export declare function decimal(): MySqlDecimalBuilderInitial<''>;
|
|
31
|
-
export declare function decimal(config: MySqlDecimalConfig): MySqlDecimalBuilderInitial<''>;
|
|
32
|
-
export declare function decimal<TName extends string>(name: TName, config?: MySqlDecimalConfig): MySqlDecimalBuilderInitial<TName>;
|
|
75
|
+
export declare function decimal<TMode extends 'string' | 'number' | 'bigint'>(config: MySqlDecimalConfig<TMode>): Equal<TMode, 'number'> extends true ? MySqlDecimalNumberBuilderInitial<''> : Equal<TMode, 'bigint'> extends true ? MySqlDecimalBigIntBuilderInitial<''> : MySqlDecimalBuilderInitial<''>;
|
|
76
|
+
export declare function decimal<TName extends string, TMode extends 'string' | 'number' | 'bigint'>(name: TName, config?: MySqlDecimalConfig<TMode>): Equal<TMode, 'number'> extends true ? MySqlDecimalNumberBuilderInitial<TName> : Equal<TMode, 'bigint'> extends true ? MySqlDecimalBigIntBuilderInitial<TName> : MySqlDecimalBuilderInitial<TName>;
|
|
@@ -40,13 +40,94 @@ class MySqlDecimal extends MySqlColumnWithAutoIncrement {
|
|
|
40
40
|
return this.unsigned ? `${type} unsigned` : type;
|
|
41
41
|
}
|
|
42
42
|
}
|
|
43
|
+
class MySqlDecimalNumberBuilder extends MySqlColumnBuilderWithAutoIncrement {
|
|
44
|
+
static [entityKind] = "MySqlDecimalNumberBuilder";
|
|
45
|
+
constructor(name, config) {
|
|
46
|
+
super(name, "number", "MySqlDecimalNumber");
|
|
47
|
+
this.config.precision = config?.precision;
|
|
48
|
+
this.config.scale = config?.scale;
|
|
49
|
+
this.config.unsigned = config?.unsigned;
|
|
50
|
+
}
|
|
51
|
+
/** @internal */
|
|
52
|
+
build(table) {
|
|
53
|
+
return new MySqlDecimalNumber(
|
|
54
|
+
table,
|
|
55
|
+
this.config
|
|
56
|
+
);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
class MySqlDecimalNumber extends MySqlColumnWithAutoIncrement {
|
|
60
|
+
static [entityKind] = "MySqlDecimalNumber";
|
|
61
|
+
precision = this.config.precision;
|
|
62
|
+
scale = this.config.scale;
|
|
63
|
+
unsigned = this.config.unsigned;
|
|
64
|
+
mapFromDriverValue(value) {
|
|
65
|
+
if (typeof value === "number")
|
|
66
|
+
return value;
|
|
67
|
+
return Number(value);
|
|
68
|
+
}
|
|
69
|
+
mapToDriverValue = String;
|
|
70
|
+
getSQLType() {
|
|
71
|
+
let type = "";
|
|
72
|
+
if (this.precision !== void 0 && this.scale !== void 0) {
|
|
73
|
+
type += `decimal(${this.precision},${this.scale})`;
|
|
74
|
+
} else if (this.precision === void 0) {
|
|
75
|
+
type += "decimal";
|
|
76
|
+
} else {
|
|
77
|
+
type += `decimal(${this.precision})`;
|
|
78
|
+
}
|
|
79
|
+
type = type === "decimal(10,0)" || type === "decimal(10)" ? "decimal" : type;
|
|
80
|
+
return this.unsigned ? `${type} unsigned` : type;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
class MySqlDecimalBigIntBuilder extends MySqlColumnBuilderWithAutoIncrement {
|
|
84
|
+
static [entityKind] = "MySqlDecimalBigIntBuilder";
|
|
85
|
+
constructor(name, config) {
|
|
86
|
+
super(name, "bigint", "MySqlDecimalBigInt");
|
|
87
|
+
this.config.precision = config?.precision;
|
|
88
|
+
this.config.scale = config?.scale;
|
|
89
|
+
this.config.unsigned = config?.unsigned;
|
|
90
|
+
}
|
|
91
|
+
/** @internal */
|
|
92
|
+
build(table) {
|
|
93
|
+
return new MySqlDecimalBigInt(
|
|
94
|
+
table,
|
|
95
|
+
this.config
|
|
96
|
+
);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
class MySqlDecimalBigInt extends MySqlColumnWithAutoIncrement {
|
|
100
|
+
static [entityKind] = "MySqlDecimalBigInt";
|
|
101
|
+
precision = this.config.precision;
|
|
102
|
+
scale = this.config.scale;
|
|
103
|
+
unsigned = this.config.unsigned;
|
|
104
|
+
mapFromDriverValue = BigInt;
|
|
105
|
+
mapToDriverValue = String;
|
|
106
|
+
getSQLType() {
|
|
107
|
+
let type = "";
|
|
108
|
+
if (this.precision !== void 0 && this.scale !== void 0) {
|
|
109
|
+
type += `decimal(${this.precision},${this.scale})`;
|
|
110
|
+
} else if (this.precision === void 0) {
|
|
111
|
+
type += "decimal";
|
|
112
|
+
} else {
|
|
113
|
+
type += `decimal(${this.precision})`;
|
|
114
|
+
}
|
|
115
|
+
type = type === "decimal(10,0)" || type === "decimal(10)" ? "decimal" : type;
|
|
116
|
+
return this.unsigned ? `${type} unsigned` : type;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
43
119
|
function decimal(a, b = {}) {
|
|
44
120
|
const { name, config } = getColumnNameAndConfig(a, b);
|
|
45
|
-
|
|
121
|
+
const mode = config?.mode;
|
|
122
|
+
return mode === "number" ? new MySqlDecimalNumberBuilder(name, config) : mode === "bigint" ? new MySqlDecimalBigIntBuilder(name, config) : new MySqlDecimalBuilder(name, config);
|
|
46
123
|
}
|
|
47
124
|
export {
|
|
48
125
|
MySqlDecimal,
|
|
126
|
+
MySqlDecimalBigInt,
|
|
127
|
+
MySqlDecimalBigIntBuilder,
|
|
49
128
|
MySqlDecimalBuilder,
|
|
129
|
+
MySqlDecimalNumber,
|
|
130
|
+
MySqlDecimalNumberBuilder,
|
|
50
131
|
decimal
|
|
51
132
|
};
|
|
52
133
|
//# sourceMappingURL=decimal.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/mysql-core/columns/decimal.ts"],"sourcesContent":["import type { ColumnBuilderBaseConfig, ColumnBuilderRuntimeConfig, MakeColumnConfig } from '~/column-builder.ts';\nimport type { ColumnBaseConfig } from '~/column.ts';\nimport { entityKind } from '~/entity.ts';\nimport type { AnyMySqlTable } from '~/mysql-core/table.ts';\nimport { getColumnNameAndConfig } from '~/utils.ts';\nimport { MySqlColumnBuilderWithAutoIncrement, MySqlColumnWithAutoIncrement } from './common.ts';\n\nexport type MySqlDecimalBuilderInitial<TName extends string> = MySqlDecimalBuilder<{\n\tname: TName;\n\tdataType: 'string';\n\tcolumnType: 'MySqlDecimal';\n\tdata: string;\n\tdriverParam: string;\n\tenumValues: undefined;\n}>;\n\nexport class MySqlDecimalBuilder<\n\tT extends ColumnBuilderBaseConfig<'string', 'MySqlDecimal'>,\n> extends MySqlColumnBuilderWithAutoIncrement<T, MySqlDecimalConfig> {\n\tstatic override readonly [entityKind]: string = 'MySqlDecimalBuilder';\n\n\tconstructor(name: T['name'], config: MySqlDecimalConfig | undefined) {\n\t\tsuper(name, 'string', 'MySqlDecimal');\n\t\tthis.config.precision = config?.precision;\n\t\tthis.config.scale = config?.scale;\n\t\tthis.config.unsigned = config?.unsigned;\n\t}\n\n\t/** @internal */\n\toverride build<TTableName extends string>(\n\t\ttable: AnyMySqlTable<{ name: TTableName }>,\n\t): MySqlDecimal<MakeColumnConfig<T, TTableName>> {\n\t\treturn new MySqlDecimal<MakeColumnConfig<T, TTableName>>(\n\t\t\ttable,\n\t\t\tthis.config as ColumnBuilderRuntimeConfig<any, any>,\n\t\t);\n\t}\n}\n\nexport class MySqlDecimal<T extends ColumnBaseConfig<'string', 'MySqlDecimal'>>\n\textends MySqlColumnWithAutoIncrement<T, MySqlDecimalConfig>\n{\n\tstatic override readonly [entityKind]: string = 'MySqlDecimal';\n\n\treadonly precision: number | undefined = this.config.precision;\n\treadonly scale: number | undefined = this.config.scale;\n\treadonly unsigned: boolean | undefined = this.config.unsigned;\n\n\toverride mapFromDriverValue(value: unknown): string {\n\t\t// For RQBv2\n\t\tif (typeof value === 'string') return value;\n\n\t\treturn String(value);\n\t}\n\n\tgetSQLType(): string {\n\t\tlet type = '';\n\t\tif (this.precision !== undefined && this.scale !== undefined) {\n\t\t\ttype += `decimal(${this.precision},${this.scale})`;\n\t\t} else if (this.precision === undefined) {\n\t\t\ttype += 'decimal';\n\t\t} else {\n\t\t\ttype += `decimal(${this.precision})`;\n\t\t}\n\t\ttype = type === 'decimal(10,0)' || type === 'decimal(10)' ? 'decimal' : type;\n\t\treturn this.unsigned ? `${type} unsigned` : type;\n\t}\n}\n\nexport interface MySqlDecimalConfig {\n\tprecision?: number;\n\tscale?: number;\n\tunsigned?: boolean;\n}\n\nexport function decimal(): MySqlDecimalBuilderInitial<''>;\nexport function decimal(\n\tconfig: MySqlDecimalConfig,\n): MySqlDecimalBuilderInitial<''>;\nexport function decimal<TName extends string>(\n\tname: TName,\n\tconfig?: MySqlDecimalConfig,\n): MySqlDecimalBuilderInitial<TName>;\nexport function decimal(a?: string | MySqlDecimalConfig, b: MySqlDecimalConfig = {}) {\n\tconst { name, config } = getColumnNameAndConfig<MySqlDecimalConfig>(a, b);\n\treturn new MySqlDecimalBuilder(name, config);\n}\n"],"mappings":"AAEA,SAAS,kBAAkB;AAE3B,SAAS,8BAA8B;AACvC,SAAS,qCAAqC,oCAAoC;AAW3E,MAAM,4BAEH,oCAA2D;AAAA,EACpE,QAA0B,UAAU,IAAY;AAAA,EAEhD,YAAY,MAAiB,QAAwC;AACpE,UAAM,MAAM,UAAU,cAAc;AACpC,SAAK,OAAO,YAAY,QAAQ;AAChC,SAAK,OAAO,QAAQ,QAAQ;AAC5B,SAAK,OAAO,WAAW,QAAQ;AAAA,EAChC;AAAA;AAAA,EAGS,MACR,OACgD;AAChD,WAAO,IAAI;AAAA,MACV;AAAA,MACA,KAAK;AAAA,IACN;AAAA,EACD;AACD;AAEO,MAAM,qBACJ,6BACT;AAAA,EACC,QAA0B,UAAU,IAAY;AAAA,EAEvC,YAAgC,KAAK,OAAO;AAAA,EAC5C,QAA4B,KAAK,OAAO;AAAA,EACxC,WAAgC,KAAK,OAAO;AAAA,EAE5C,mBAAmB,OAAwB;AAEnD,QAAI,OAAO,UAAU;AAAU,aAAO;AAEtC,WAAO,OAAO,KAAK;AAAA,EACpB;AAAA,EAEA,aAAqB;AACpB,QAAI,OAAO;AACX,QAAI,KAAK,cAAc,UAAa,KAAK,UAAU,QAAW;AAC7D,cAAQ,WAAW,KAAK,SAAS,IAAI,KAAK,KAAK;AAAA,IAChD,WAAW,KAAK,cAAc,QAAW;AACxC,cAAQ;AAAA,IACT,OAAO;AACN,cAAQ,WAAW,KAAK,SAAS;AAAA,IAClC;AACA,WAAO,SAAS,mBAAmB,SAAS,gBAAgB,YAAY;AACxE,WAAO,KAAK,WAAW,GAAG,IAAI,cAAc;AAAA,EAC7C;AACD;AAgBO,SAAS,QAAQ,GAAiC,IAAwB,CAAC,GAAG;AACpF,QAAM,EAAE,MAAM,OAAO,IAAI,uBAA2C,GAAG,CAAC;AACxE,SAAO,IAAI,oBAAoB,MAAM,MAAM;AAC5C;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../../src/mysql-core/columns/decimal.ts"],"sourcesContent":["import type { ColumnBuilderBaseConfig, ColumnBuilderRuntimeConfig, MakeColumnConfig } from '~/column-builder.ts';\nimport type { ColumnBaseConfig } from '~/column.ts';\nimport { entityKind } from '~/entity.ts';\nimport type { AnyMySqlTable } from '~/mysql-core/table.ts';\nimport { type Equal, getColumnNameAndConfig } from '~/utils.ts';\nimport { MySqlColumnBuilderWithAutoIncrement, MySqlColumnWithAutoIncrement } from './common.ts';\n\nexport type MySqlDecimalBuilderInitial<TName extends string> = MySqlDecimalBuilder<{\n\tname: TName;\n\tdataType: 'string';\n\tcolumnType: 'MySqlDecimal';\n\tdata: string;\n\tdriverParam: string;\n\tenumValues: undefined;\n}>;\n\nexport class MySqlDecimalBuilder<\n\tT extends ColumnBuilderBaseConfig<'string', 'MySqlDecimal'>,\n> extends MySqlColumnBuilderWithAutoIncrement<T, MySqlDecimalConfig> {\n\tstatic override readonly [entityKind]: string = 'MySqlDecimalBuilder';\n\n\tconstructor(name: T['name'], config: MySqlDecimalConfig | undefined) {\n\t\tsuper(name, 'string', 'MySqlDecimal');\n\t\tthis.config.precision = config?.precision;\n\t\tthis.config.scale = config?.scale;\n\t\tthis.config.unsigned = config?.unsigned;\n\t}\n\n\t/** @internal */\n\toverride build<TTableName extends string>(\n\t\ttable: AnyMySqlTable<{ name: TTableName }>,\n\t): MySqlDecimal<MakeColumnConfig<T, TTableName>> {\n\t\treturn new MySqlDecimal<MakeColumnConfig<T, TTableName>>(\n\t\t\ttable,\n\t\t\tthis.config as ColumnBuilderRuntimeConfig<any, any>,\n\t\t);\n\t}\n}\n\nexport class MySqlDecimal<T extends ColumnBaseConfig<'string', 'MySqlDecimal'>>\n\textends MySqlColumnWithAutoIncrement<T, MySqlDecimalConfig>\n{\n\tstatic override readonly [entityKind]: string = 'MySqlDecimal';\n\n\treadonly precision: number | undefined = this.config.precision;\n\treadonly scale: number | undefined = this.config.scale;\n\treadonly unsigned: boolean | undefined = this.config.unsigned;\n\n\toverride mapFromDriverValue(value: unknown): string {\n\t\t// For RQBv2\n\t\tif (typeof value === 'string') return value;\n\n\t\treturn String(value);\n\t}\n\n\tgetSQLType(): string {\n\t\tlet type = '';\n\t\tif (this.precision !== undefined && this.scale !== undefined) {\n\t\t\ttype += `decimal(${this.precision},${this.scale})`;\n\t\t} else if (this.precision === undefined) {\n\t\t\ttype += 'decimal';\n\t\t} else {\n\t\t\ttype += `decimal(${this.precision})`;\n\t\t}\n\t\ttype = type === 'decimal(10,0)' || type === 'decimal(10)' ? 'decimal' : type;\n\t\treturn this.unsigned ? `${type} unsigned` : type;\n\t}\n}\n\nexport type MySqlDecimalNumberBuilderInitial<TName extends string> = MySqlDecimalNumberBuilder<{\n\tname: TName;\n\tdataType: 'number';\n\tcolumnType: 'MySqlDecimalNumber';\n\tdata: number;\n\tdriverParam: string;\n\tenumValues: undefined;\n}>;\n\nexport class MySqlDecimalNumberBuilder<\n\tT extends ColumnBuilderBaseConfig<'number', 'MySqlDecimalNumber'>,\n> extends MySqlColumnBuilderWithAutoIncrement<T, MySqlDecimalConfig> {\n\tstatic override readonly [entityKind]: string = 'MySqlDecimalNumberBuilder';\n\n\tconstructor(name: T['name'], config: MySqlDecimalConfig | undefined) {\n\t\tsuper(name, 'number', 'MySqlDecimalNumber');\n\t\tthis.config.precision = config?.precision;\n\t\tthis.config.scale = config?.scale;\n\t\tthis.config.unsigned = config?.unsigned;\n\t}\n\n\t/** @internal */\n\toverride build<TTableName extends string>(\n\t\ttable: AnyMySqlTable<{ name: TTableName }>,\n\t): MySqlDecimalNumber<MakeColumnConfig<T, TTableName>> {\n\t\treturn new MySqlDecimalNumber<MakeColumnConfig<T, TTableName>>(\n\t\t\ttable,\n\t\t\tthis.config as ColumnBuilderRuntimeConfig<any, any>,\n\t\t);\n\t}\n}\n\nexport class MySqlDecimalNumber<T extends ColumnBaseConfig<'number', 'MySqlDecimalNumber'>>\n\textends MySqlColumnWithAutoIncrement<T, MySqlDecimalConfig>\n{\n\tstatic override readonly [entityKind]: string = 'MySqlDecimalNumber';\n\n\treadonly precision: number | undefined = this.config.precision;\n\treadonly scale: number | undefined = this.config.scale;\n\treadonly unsigned: boolean | undefined = this.config.unsigned;\n\n\toverride mapFromDriverValue(value: unknown): number {\n\t\tif (typeof value === 'number') return value;\n\n\t\treturn Number(value);\n\t}\n\n\toverride mapToDriverValue = String;\n\n\tgetSQLType(): string {\n\t\tlet type = '';\n\t\tif (this.precision !== undefined && this.scale !== undefined) {\n\t\t\ttype += `decimal(${this.precision},${this.scale})`;\n\t\t} else if (this.precision === undefined) {\n\t\t\ttype += 'decimal';\n\t\t} else {\n\t\t\ttype += `decimal(${this.precision})`;\n\t\t}\n\t\ttype = type === 'decimal(10,0)' || type === 'decimal(10)' ? 'decimal' : type;\n\t\treturn this.unsigned ? `${type} unsigned` : type;\n\t}\n}\n\nexport type MySqlDecimalBigIntBuilderInitial<TName extends string> = MySqlDecimalBigIntBuilder<{\n\tname: TName;\n\tdataType: 'bigint';\n\tcolumnType: 'MySqlDecimalBigInt';\n\tdata: bigint;\n\tdriverParam: string;\n\tenumValues: undefined;\n}>;\n\nexport class MySqlDecimalBigIntBuilder<\n\tT extends ColumnBuilderBaseConfig<'bigint', 'MySqlDecimalBigInt'>,\n> extends MySqlColumnBuilderWithAutoIncrement<T, MySqlDecimalConfig> {\n\tstatic override readonly [entityKind]: string = 'MySqlDecimalBigIntBuilder';\n\n\tconstructor(name: T['name'], config: MySqlDecimalConfig | undefined) {\n\t\tsuper(name, 'bigint', 'MySqlDecimalBigInt');\n\t\tthis.config.precision = config?.precision;\n\t\tthis.config.scale = config?.scale;\n\t\tthis.config.unsigned = config?.unsigned;\n\t}\n\n\t/** @internal */\n\toverride build<TTableName extends string>(\n\t\ttable: AnyMySqlTable<{ name: TTableName }>,\n\t): MySqlDecimalBigInt<MakeColumnConfig<T, TTableName>> {\n\t\treturn new MySqlDecimalBigInt<MakeColumnConfig<T, TTableName>>(\n\t\t\ttable,\n\t\t\tthis.config as ColumnBuilderRuntimeConfig<any, any>,\n\t\t);\n\t}\n}\n\nexport class MySqlDecimalBigInt<T extends ColumnBaseConfig<'bigint', 'MySqlDecimalBigInt'>>\n\textends MySqlColumnWithAutoIncrement<T, MySqlDecimalConfig>\n{\n\tstatic override readonly [entityKind]: string = 'MySqlDecimalBigInt';\n\n\treadonly precision: number | undefined = this.config.precision;\n\treadonly scale: number | undefined = this.config.scale;\n\treadonly unsigned: boolean | undefined = this.config.unsigned;\n\n\toverride mapFromDriverValue = BigInt;\n\n\toverride mapToDriverValue = String;\n\n\tgetSQLType(): string {\n\t\tlet type = '';\n\t\tif (this.precision !== undefined && this.scale !== undefined) {\n\t\t\ttype += `decimal(${this.precision},${this.scale})`;\n\t\t} else if (this.precision === undefined) {\n\t\t\ttype += 'decimal';\n\t\t} else {\n\t\t\ttype += `decimal(${this.precision})`;\n\t\t}\n\t\ttype = type === 'decimal(10,0)' || type === 'decimal(10)' ? 'decimal' : type;\n\t\treturn this.unsigned ? `${type} unsigned` : type;\n\t}\n}\n\nexport interface MySqlDecimalConfig<T extends 'string' | 'number' | 'bigint' = 'string' | 'number' | 'bigint'> {\n\tprecision?: number;\n\tscale?: number;\n\tunsigned?: boolean;\n\tmode?: T;\n}\n\nexport function decimal(): MySqlDecimalBuilderInitial<''>;\nexport function decimal<TMode extends 'string' | 'number' | 'bigint'>(\n\tconfig: MySqlDecimalConfig<TMode>,\n): Equal<TMode, 'number'> extends true ? MySqlDecimalNumberBuilderInitial<''>\n\t: Equal<TMode, 'bigint'> extends true ? MySqlDecimalBigIntBuilderInitial<''>\n\t: MySqlDecimalBuilderInitial<''>;\nexport function decimal<TName extends string, TMode extends 'string' | 'number' | 'bigint'>(\n\tname: TName,\n\tconfig?: MySqlDecimalConfig<TMode>,\n): Equal<TMode, 'number'> extends true ? MySqlDecimalNumberBuilderInitial<TName>\n\t: Equal<TMode, 'bigint'> extends true ? MySqlDecimalBigIntBuilderInitial<TName>\n\t: MySqlDecimalBuilderInitial<TName>;\nexport function decimal(a?: string | MySqlDecimalConfig, b: MySqlDecimalConfig = {}) {\n\tconst { name, config } = getColumnNameAndConfig<MySqlDecimalConfig>(a, b);\n\tconst mode = config?.mode;\n\treturn mode === 'number'\n\t\t? new MySqlDecimalNumberBuilder(name, config)\n\t\t: mode === 'bigint'\n\t\t? new MySqlDecimalBigIntBuilder(name, config)\n\t\t: new MySqlDecimalBuilder(name, config);\n}\n"],"mappings":"AAEA,SAAS,kBAAkB;AAE3B,SAAqB,8BAA8B;AACnD,SAAS,qCAAqC,oCAAoC;AAW3E,MAAM,4BAEH,oCAA2D;AAAA,EACpE,QAA0B,UAAU,IAAY;AAAA,EAEhD,YAAY,MAAiB,QAAwC;AACpE,UAAM,MAAM,UAAU,cAAc;AACpC,SAAK,OAAO,YAAY,QAAQ;AAChC,SAAK,OAAO,QAAQ,QAAQ;AAC5B,SAAK,OAAO,WAAW,QAAQ;AAAA,EAChC;AAAA;AAAA,EAGS,MACR,OACgD;AAChD,WAAO,IAAI;AAAA,MACV;AAAA,MACA,KAAK;AAAA,IACN;AAAA,EACD;AACD;AAEO,MAAM,qBACJ,6BACT;AAAA,EACC,QAA0B,UAAU,IAAY;AAAA,EAEvC,YAAgC,KAAK,OAAO;AAAA,EAC5C,QAA4B,KAAK,OAAO;AAAA,EACxC,WAAgC,KAAK,OAAO;AAAA,EAE5C,mBAAmB,OAAwB;AAEnD,QAAI,OAAO,UAAU;AAAU,aAAO;AAEtC,WAAO,OAAO,KAAK;AAAA,EACpB;AAAA,EAEA,aAAqB;AACpB,QAAI,OAAO;AACX,QAAI,KAAK,cAAc,UAAa,KAAK,UAAU,QAAW;AAC7D,cAAQ,WAAW,KAAK,SAAS,IAAI,KAAK,KAAK;AAAA,IAChD,WAAW,KAAK,cAAc,QAAW;AACxC,cAAQ;AAAA,IACT,OAAO;AACN,cAAQ,WAAW,KAAK,SAAS;AAAA,IAClC;AACA,WAAO,SAAS,mBAAmB,SAAS,gBAAgB,YAAY;AACxE,WAAO,KAAK,WAAW,GAAG,IAAI,cAAc;AAAA,EAC7C;AACD;AAWO,MAAM,kCAEH,oCAA2D;AAAA,EACpE,QAA0B,UAAU,IAAY;AAAA,EAEhD,YAAY,MAAiB,QAAwC;AACpE,UAAM,MAAM,UAAU,oBAAoB;AAC1C,SAAK,OAAO,YAAY,QAAQ;AAChC,SAAK,OAAO,QAAQ,QAAQ;AAC5B,SAAK,OAAO,WAAW,QAAQ;AAAA,EAChC;AAAA;AAAA,EAGS,MACR,OACsD;AACtD,WAAO,IAAI;AAAA,MACV;AAAA,MACA,KAAK;AAAA,IACN;AAAA,EACD;AACD;AAEO,MAAM,2BACJ,6BACT;AAAA,EACC,QAA0B,UAAU,IAAY;AAAA,EAEvC,YAAgC,KAAK,OAAO;AAAA,EAC5C,QAA4B,KAAK,OAAO;AAAA,EACxC,WAAgC,KAAK,OAAO;AAAA,EAE5C,mBAAmB,OAAwB;AACnD,QAAI,OAAO,UAAU;AAAU,aAAO;AAEtC,WAAO,OAAO,KAAK;AAAA,EACpB;AAAA,EAES,mBAAmB;AAAA,EAE5B,aAAqB;AACpB,QAAI,OAAO;AACX,QAAI,KAAK,cAAc,UAAa,KAAK,UAAU,QAAW;AAC7D,cAAQ,WAAW,KAAK,SAAS,IAAI,KAAK,KAAK;AAAA,IAChD,WAAW,KAAK,cAAc,QAAW;AACxC,cAAQ;AAAA,IACT,OAAO;AACN,cAAQ,WAAW,KAAK,SAAS;AAAA,IAClC;AACA,WAAO,SAAS,mBAAmB,SAAS,gBAAgB,YAAY;AACxE,WAAO,KAAK,WAAW,GAAG,IAAI,cAAc;AAAA,EAC7C;AACD;AAWO,MAAM,kCAEH,oCAA2D;AAAA,EACpE,QAA0B,UAAU,IAAY;AAAA,EAEhD,YAAY,MAAiB,QAAwC;AACpE,UAAM,MAAM,UAAU,oBAAoB;AAC1C,SAAK,OAAO,YAAY,QAAQ;AAChC,SAAK,OAAO,QAAQ,QAAQ;AAC5B,SAAK,OAAO,WAAW,QAAQ;AAAA,EAChC;AAAA;AAAA,EAGS,MACR,OACsD;AACtD,WAAO,IAAI;AAAA,MACV;AAAA,MACA,KAAK;AAAA,IACN;AAAA,EACD;AACD;AAEO,MAAM,2BACJ,6BACT;AAAA,EACC,QAA0B,UAAU,IAAY;AAAA,EAEvC,YAAgC,KAAK,OAAO;AAAA,EAC5C,QAA4B,KAAK,OAAO;AAAA,EACxC,WAAgC,KAAK,OAAO;AAAA,EAE5C,qBAAqB;AAAA,EAErB,mBAAmB;AAAA,EAE5B,aAAqB;AACpB,QAAI,OAAO;AACX,QAAI,KAAK,cAAc,UAAa,KAAK,UAAU,QAAW;AAC7D,cAAQ,WAAW,KAAK,SAAS,IAAI,KAAK,KAAK;AAAA,IAChD,WAAW,KAAK,cAAc,QAAW;AACxC,cAAQ;AAAA,IACT,OAAO;AACN,cAAQ,WAAW,KAAK,SAAS;AAAA,IAClC;AACA,WAAO,SAAS,mBAAmB,SAAS,gBAAgB,YAAY;AACxE,WAAO,KAAK,WAAW,GAAG,IAAI,cAAc;AAAA,EAC7C;AACD;AAqBO,SAAS,QAAQ,GAAiC,IAAwB,CAAC,GAAG;AACpF,QAAM,EAAE,MAAM,OAAO,IAAI,uBAA2C,GAAG,CAAC;AACxE,QAAM,OAAO,QAAQ;AACrB,SAAO,SAAS,WACb,IAAI,0BAA0B,MAAM,MAAM,IAC1C,SAAS,WACT,IAAI,0BAA0B,MAAM,MAAM,IAC1C,IAAI,oBAAoB,MAAM,MAAM;AACxC;","names":[]}
|
package/mysql-core/dialect.cjs
CHANGED
|
@@ -875,6 +875,9 @@ class MySqlDialect {
|
|
|
875
875
|
case "MySqlDateTimeString":
|
|
876
876
|
case "MySqlTimestampString":
|
|
877
877
|
case "MySqlFloat":
|
|
878
|
+
case "MySqlDecimal":
|
|
879
|
+
case "MySqlDecimalNumber":
|
|
880
|
+
case "MySqlDecimalBigInt":
|
|
878
881
|
case "MySqlBigInt64": {
|
|
879
882
|
return import_sql.sql`cast(${name} as char) as ${import_sql.sql.identifier(key)}`;
|
|
880
883
|
}
|