drizzle-orm 1.0.0-beta.1-867d080 → 1.0.0-beta.1-e5790ad
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 +1 -86
- package/mysql-core/columns/decimal.cjs.map +1 -1
- package/mysql-core/columns/decimal.d.cts +3 -47
- package/mysql-core/columns/decimal.d.ts +3 -47
- package/mysql-core/columns/decimal.js +1 -82
- package/mysql-core/columns/decimal.js.map +1 -1
- package/mysql-core/dialect.cjs +0 -3
- package/mysql-core/dialect.cjs.map +1 -1
- package/mysql-core/dialect.js +0 -3
- package/mysql-core/dialect.js.map +1 -1
- package/neon-http/session.cjs +12 -8
- package/neon-http/session.cjs.map +1 -1
- package/neon-http/session.d.cts +2 -0
- package/neon-http/session.d.ts +2 -0
- package/neon-http/session.js +12 -8
- package/neon-http/session.js.map +1 -1
- package/neon-serverless/session.cjs +0 -6
- package/neon-serverless/session.cjs.map +1 -1
- package/neon-serverless/session.js +0 -6
- package/neon-serverless/session.js.map +1 -1
- package/node-postgres/session.cjs +0 -6
- package/node-postgres/session.cjs.map +1 -1
- package/node-postgres/session.js +0 -6
- package/node-postgres/session.js.map +1 -1
- package/package.json +1 -1
- package/pg-core/columns/numeric.cjs +1 -86
- package/pg-core/columns/numeric.cjs.map +1 -1
- package/pg-core/columns/numeric.d.cts +6 -61
- package/pg-core/columns/numeric.d.ts +6 -61
- package/pg-core/columns/numeric.js +1 -82
- package/pg-core/columns/numeric.js.map +1 -1
- package/pg-core/dialect.cjs +0 -2
- package/pg-core/dialect.cjs.map +1 -1
- package/pg-core/dialect.js +0 -2
- package/pg-core/dialect.js.map +1 -1
- package/pglite/session.cjs +0 -8
- package/pglite/session.cjs.map +1 -1
- package/pglite/session.js +0 -8
- 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/sqlite-core/columns/numeric.cjs +2 -64
- package/sqlite-core/columns/numeric.cjs.map +1 -1
- package/sqlite-core/columns/numeric.d.cts +2 -43
- package/sqlite-core/columns/numeric.d.ts +2 -43
- package/sqlite-core/columns/numeric.js +2 -60
- package/sqlite-core/columns/numeric.js.map +1 -1
- package/sqlite-core/dialect.cjs +0 -5
- package/sqlite-core/dialect.cjs.map +1 -1
- package/sqlite-core/dialect.js +0 -5
- package/sqlite-core/dialect.js.map +1 -1
- package/vercel-postgres/session.cjs +0 -6
- package/vercel-postgres/session.cjs.map +1 -1
- package/vercel-postgres/session.js +0 -6
- 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,16 +19,11 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
19
19
|
var numeric_exports = {};
|
|
20
20
|
__export(numeric_exports, {
|
|
21
21
|
SQLiteNumeric: () => SQLiteNumeric,
|
|
22
|
-
SQLiteNumericBigInt: () => SQLiteNumericBigInt,
|
|
23
|
-
SQLiteNumericBigIntBuilder: () => SQLiteNumericBigIntBuilder,
|
|
24
22
|
SQLiteNumericBuilder: () => SQLiteNumericBuilder,
|
|
25
|
-
SQLiteNumericNumber: () => SQLiteNumericNumber,
|
|
26
|
-
SQLiteNumericNumberBuilder: () => SQLiteNumericNumberBuilder,
|
|
27
23
|
numeric: () => numeric
|
|
28
24
|
});
|
|
29
25
|
module.exports = __toCommonJS(numeric_exports);
|
|
30
26
|
var import_entity = require("../../entity.cjs");
|
|
31
|
-
var import_utils = require("../../utils.cjs");
|
|
32
27
|
var import_common = require("./common.cjs");
|
|
33
28
|
class SQLiteNumericBuilder extends import_common.SQLiteColumnBuilder {
|
|
34
29
|
static [import_entity.entityKind] = "SQLiteNumericBuilder";
|
|
@@ -45,74 +40,17 @@ class SQLiteNumericBuilder extends import_common.SQLiteColumnBuilder {
|
|
|
45
40
|
}
|
|
46
41
|
class SQLiteNumeric extends import_common.SQLiteColumn {
|
|
47
42
|
static [import_entity.entityKind] = "SQLiteNumeric";
|
|
48
|
-
mapFromDriverValue(value) {
|
|
49
|
-
if (typeof value === "string")
|
|
50
|
-
return value;
|
|
51
|
-
return String(value);
|
|
52
|
-
}
|
|
53
|
-
getSQLType() {
|
|
54
|
-
return "numeric";
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
class SQLiteNumericNumberBuilder extends import_common.SQLiteColumnBuilder {
|
|
58
|
-
static [import_entity.entityKind] = "SQLiteNumericNumberBuilder";
|
|
59
|
-
constructor(name) {
|
|
60
|
-
super(name, "number", "SQLiteNumericNumber");
|
|
61
|
-
}
|
|
62
|
-
/** @internal */
|
|
63
|
-
build(table) {
|
|
64
|
-
return new SQLiteNumericNumber(
|
|
65
|
-
table,
|
|
66
|
-
this.config
|
|
67
|
-
);
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
class SQLiteNumericNumber extends import_common.SQLiteColumn {
|
|
71
|
-
static [import_entity.entityKind] = "SQLiteNumericNumber";
|
|
72
|
-
mapFromDriverValue(value) {
|
|
73
|
-
if (typeof value === "number")
|
|
74
|
-
return value;
|
|
75
|
-
return Number(value);
|
|
76
|
-
}
|
|
77
|
-
mapToDriverValue = String;
|
|
78
|
-
getSQLType() {
|
|
79
|
-
return "numeric";
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
class SQLiteNumericBigIntBuilder extends import_common.SQLiteColumnBuilder {
|
|
83
|
-
static [import_entity.entityKind] = "SQLiteNumericBigIntBuilder";
|
|
84
|
-
constructor(name) {
|
|
85
|
-
super(name, "bigint", "SQLiteNumericBigInt");
|
|
86
|
-
}
|
|
87
|
-
/** @internal */
|
|
88
|
-
build(table) {
|
|
89
|
-
return new SQLiteNumericBigInt(
|
|
90
|
-
table,
|
|
91
|
-
this.config
|
|
92
|
-
);
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
class SQLiteNumericBigInt extends import_common.SQLiteColumn {
|
|
96
|
-
static [import_entity.entityKind] = "SQLiteNumericBigInt";
|
|
97
|
-
mapFromDriverValue = BigInt;
|
|
98
|
-
mapToDriverValue = String;
|
|
99
43
|
getSQLType() {
|
|
100
44
|
return "numeric";
|
|
101
45
|
}
|
|
102
46
|
}
|
|
103
|
-
function numeric(
|
|
104
|
-
|
|
105
|
-
const mode = config?.mode;
|
|
106
|
-
return mode === "number" ? new SQLiteNumericNumberBuilder(name) : mode === "bigint" ? new SQLiteNumericBigIntBuilder(name) : new SQLiteNumericBuilder(name);
|
|
47
|
+
function numeric(name) {
|
|
48
|
+
return new SQLiteNumericBuilder(name ?? "");
|
|
107
49
|
}
|
|
108
50
|
// Annotate the CommonJS export names for ESM import in node:
|
|
109
51
|
0 && (module.exports = {
|
|
110
52
|
SQLiteNumeric,
|
|
111
|
-
SQLiteNumericBigInt,
|
|
112
|
-
SQLiteNumericBigIntBuilder,
|
|
113
53
|
SQLiteNumericBuilder,
|
|
114
|
-
SQLiteNumericNumber,
|
|
115
|
-
SQLiteNumericNumberBuilder,
|
|
116
54
|
numeric
|
|
117
55
|
});
|
|
118
56
|
//# sourceMappingURL=numeric.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/sqlite-core/columns/numeric.ts"],"sourcesContent":["import type { ColumnBuilderBaseConfig, ColumnBuilderRuntimeConfig, MakeColumnConfig } from '~/column-builder.ts';\nimport type { ColumnBaseConfig } from '~/column.ts';\nimport { entityKind } from '~/entity.ts';\nimport type { AnySQLiteTable } from '~/sqlite-core/table.ts';\nimport {
|
|
1
|
+
{"version":3,"sources":["../../../src/sqlite-core/columns/numeric.ts"],"sourcesContent":["import type { ColumnBuilderBaseConfig, ColumnBuilderRuntimeConfig, MakeColumnConfig } from '~/column-builder.ts';\nimport type { ColumnBaseConfig } from '~/column.ts';\nimport { entityKind } from '~/entity.ts';\nimport type { AnySQLiteTable } from '~/sqlite-core/table.ts';\nimport { SQLiteColumn, SQLiteColumnBuilder } from './common.ts';\n\nexport type SQLiteNumericBuilderInitial<TName extends string> = SQLiteNumericBuilder<{\n\tname: TName;\n\tdataType: 'string';\n\tcolumnType: 'SQLiteNumeric';\n\tdata: string;\n\tdriverParam: string;\n\tenumValues: undefined;\n}>;\n\nexport class SQLiteNumericBuilder<T extends ColumnBuilderBaseConfig<'string', 'SQLiteNumeric'>>\n\textends SQLiteColumnBuilder<T>\n{\n\tstatic override readonly [entityKind]: string = 'SQLiteNumericBuilder';\n\n\tconstructor(name: T['name']) {\n\t\tsuper(name, 'string', 'SQLiteNumeric');\n\t}\n\n\t/** @internal */\n\toverride build<TTableName extends string>(\n\t\ttable: AnySQLiteTable<{ name: TTableName }>,\n\t): SQLiteNumeric<MakeColumnConfig<T, TTableName>> {\n\t\treturn new SQLiteNumeric<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 SQLiteNumeric<T extends ColumnBaseConfig<'string', 'SQLiteNumeric'>> extends SQLiteColumn<T> {\n\tstatic override readonly [entityKind]: string = 'SQLiteNumeric';\n\n\tgetSQLType(): string {\n\t\treturn 'numeric';\n\t}\n}\n\nexport function numeric(): SQLiteNumericBuilderInitial<''>;\nexport function numeric<TName extends string>(name: TName): SQLiteNumericBuilderInitial<TName>;\nexport function numeric(name?: string) {\n\treturn new SQLiteNumericBuilder(name ?? '');\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,oBAA2B;AAE3B,oBAAkD;AAW3C,MAAM,6BACJ,kCACT;AAAA,EACC,QAA0B,wBAAU,IAAY;AAAA,EAEhD,YAAY,MAAiB;AAC5B,UAAM,MAAM,UAAU,eAAe;AAAA,EACtC;AAAA;AAAA,EAGS,MACR,OACiD;AACjD,WAAO,IAAI;AAAA,MACV;AAAA,MACA,KAAK;AAAA,IACN;AAAA,EACD;AACD;AAEO,MAAM,sBAA6E,2BAAgB;AAAA,EACzG,QAA0B,wBAAU,IAAY;AAAA,EAEhD,aAAqB;AACpB,WAAO;AAAA,EACR;AACD;AAIO,SAAS,QAAQ,MAAe;AACtC,SAAO,IAAI,qBAAqB,QAAQ,EAAE;AAC3C;","names":[]}
|
|
@@ -1,7 +1,6 @@
|
|
|
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";
|
|
5
4
|
import { SQLiteColumn, SQLiteColumnBuilder } from "./common.cjs";
|
|
6
5
|
export type SQLiteNumericBuilderInitial<TName extends string> = SQLiteNumericBuilder<{
|
|
7
6
|
name: TName;
|
|
@@ -17,47 +16,7 @@ export declare class SQLiteNumericBuilder<T extends ColumnBuilderBaseConfig<'str
|
|
|
17
16
|
}
|
|
18
17
|
export declare class SQLiteNumeric<T extends ColumnBaseConfig<'string', 'SQLiteNumeric'>> extends SQLiteColumn<T> {
|
|
19
18
|
static readonly [entityKind]: string;
|
|
20
|
-
mapFromDriverValue(value: unknown): string;
|
|
21
19
|
getSQLType(): string;
|
|
22
20
|
}
|
|
23
|
-
export
|
|
24
|
-
|
|
25
|
-
dataType: 'number';
|
|
26
|
-
columnType: 'SQLiteNumericNumber';
|
|
27
|
-
data: number;
|
|
28
|
-
driverParam: string;
|
|
29
|
-
enumValues: undefined;
|
|
30
|
-
}>;
|
|
31
|
-
export declare class SQLiteNumericNumberBuilder<T extends ColumnBuilderBaseConfig<'number', 'SQLiteNumericNumber'>> extends SQLiteColumnBuilder<T> {
|
|
32
|
-
static readonly [entityKind]: string;
|
|
33
|
-
constructor(name: T['name']);
|
|
34
|
-
}
|
|
35
|
-
export declare class SQLiteNumericNumber<T extends ColumnBaseConfig<'number', 'SQLiteNumericNumber'>> extends SQLiteColumn<T> {
|
|
36
|
-
static readonly [entityKind]: string;
|
|
37
|
-
mapFromDriverValue(value: unknown): number;
|
|
38
|
-
mapToDriverValue: StringConstructor;
|
|
39
|
-
getSQLType(): string;
|
|
40
|
-
}
|
|
41
|
-
export type SQLiteNumericBigIntBuilderInitial<TName extends string> = SQLiteNumericBigIntBuilder<{
|
|
42
|
-
name: TName;
|
|
43
|
-
dataType: 'bigint';
|
|
44
|
-
columnType: 'SQLiteNumericBigInt';
|
|
45
|
-
data: bigint;
|
|
46
|
-
driverParam: string;
|
|
47
|
-
enumValues: undefined;
|
|
48
|
-
}>;
|
|
49
|
-
export declare class SQLiteNumericBigIntBuilder<T extends ColumnBuilderBaseConfig<'bigint', 'SQLiteNumericBigInt'>> extends SQLiteColumnBuilder<T> {
|
|
50
|
-
static readonly [entityKind]: string;
|
|
51
|
-
constructor(name: T['name']);
|
|
52
|
-
}
|
|
53
|
-
export declare class SQLiteNumericBigInt<T extends ColumnBaseConfig<'bigint', 'SQLiteNumericBigInt'>> extends SQLiteColumn<T> {
|
|
54
|
-
static readonly [entityKind]: string;
|
|
55
|
-
mapFromDriverValue: BigIntConstructor;
|
|
56
|
-
mapToDriverValue: StringConstructor;
|
|
57
|
-
getSQLType(): string;
|
|
58
|
-
}
|
|
59
|
-
export type SQLiteNumericConfig<T extends 'string' | 'number' | 'bigint' = 'string' | 'number' | 'bigint'> = {
|
|
60
|
-
mode: T;
|
|
61
|
-
};
|
|
62
|
-
export declare function numeric<TMode extends SQLiteNumericConfig['mode']>(config?: SQLiteNumericConfig<TMode>): Equal<TMode, 'number'> extends true ? SQLiteNumericNumberBuilderInitial<''> : Equal<TMode, 'bigint'> extends true ? SQLiteNumericBigIntBuilderInitial<''> : SQLiteNumericBuilderInitial<''>;
|
|
63
|
-
export declare function numeric<TName extends string, TMode extends SQLiteNumericConfig['mode']>(name: TName, config?: SQLiteNumericConfig<TMode>): Equal<TMode, 'number'> extends true ? SQLiteNumericNumberBuilderInitial<TName> : Equal<TMode, 'bigint'> extends true ? SQLiteNumericBigIntBuilderInitial<TName> : SQLiteNumericBuilderInitial<TName>;
|
|
21
|
+
export declare function numeric(): SQLiteNumericBuilderInitial<''>;
|
|
22
|
+
export declare function numeric<TName extends string>(name: TName): SQLiteNumericBuilderInitial<TName>;
|
|
@@ -1,7 +1,6 @@
|
|
|
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";
|
|
5
4
|
import { SQLiteColumn, SQLiteColumnBuilder } from "./common.js";
|
|
6
5
|
export type SQLiteNumericBuilderInitial<TName extends string> = SQLiteNumericBuilder<{
|
|
7
6
|
name: TName;
|
|
@@ -17,47 +16,7 @@ export declare class SQLiteNumericBuilder<T extends ColumnBuilderBaseConfig<'str
|
|
|
17
16
|
}
|
|
18
17
|
export declare class SQLiteNumeric<T extends ColumnBaseConfig<'string', 'SQLiteNumeric'>> extends SQLiteColumn<T> {
|
|
19
18
|
static readonly [entityKind]: string;
|
|
20
|
-
mapFromDriverValue(value: unknown): string;
|
|
21
19
|
getSQLType(): string;
|
|
22
20
|
}
|
|
23
|
-
export
|
|
24
|
-
|
|
25
|
-
dataType: 'number';
|
|
26
|
-
columnType: 'SQLiteNumericNumber';
|
|
27
|
-
data: number;
|
|
28
|
-
driverParam: string;
|
|
29
|
-
enumValues: undefined;
|
|
30
|
-
}>;
|
|
31
|
-
export declare class SQLiteNumericNumberBuilder<T extends ColumnBuilderBaseConfig<'number', 'SQLiteNumericNumber'>> extends SQLiteColumnBuilder<T> {
|
|
32
|
-
static readonly [entityKind]: string;
|
|
33
|
-
constructor(name: T['name']);
|
|
34
|
-
}
|
|
35
|
-
export declare class SQLiteNumericNumber<T extends ColumnBaseConfig<'number', 'SQLiteNumericNumber'>> extends SQLiteColumn<T> {
|
|
36
|
-
static readonly [entityKind]: string;
|
|
37
|
-
mapFromDriverValue(value: unknown): number;
|
|
38
|
-
mapToDriverValue: StringConstructor;
|
|
39
|
-
getSQLType(): string;
|
|
40
|
-
}
|
|
41
|
-
export type SQLiteNumericBigIntBuilderInitial<TName extends string> = SQLiteNumericBigIntBuilder<{
|
|
42
|
-
name: TName;
|
|
43
|
-
dataType: 'bigint';
|
|
44
|
-
columnType: 'SQLiteNumericBigInt';
|
|
45
|
-
data: bigint;
|
|
46
|
-
driverParam: string;
|
|
47
|
-
enumValues: undefined;
|
|
48
|
-
}>;
|
|
49
|
-
export declare class SQLiteNumericBigIntBuilder<T extends ColumnBuilderBaseConfig<'bigint', 'SQLiteNumericBigInt'>> extends SQLiteColumnBuilder<T> {
|
|
50
|
-
static readonly [entityKind]: string;
|
|
51
|
-
constructor(name: T['name']);
|
|
52
|
-
}
|
|
53
|
-
export declare class SQLiteNumericBigInt<T extends ColumnBaseConfig<'bigint', 'SQLiteNumericBigInt'>> extends SQLiteColumn<T> {
|
|
54
|
-
static readonly [entityKind]: string;
|
|
55
|
-
mapFromDriverValue: BigIntConstructor;
|
|
56
|
-
mapToDriverValue: StringConstructor;
|
|
57
|
-
getSQLType(): string;
|
|
58
|
-
}
|
|
59
|
-
export type SQLiteNumericConfig<T extends 'string' | 'number' | 'bigint' = 'string' | 'number' | 'bigint'> = {
|
|
60
|
-
mode: T;
|
|
61
|
-
};
|
|
62
|
-
export declare function numeric<TMode extends SQLiteNumericConfig['mode']>(config?: SQLiteNumericConfig<TMode>): Equal<TMode, 'number'> extends true ? SQLiteNumericNumberBuilderInitial<''> : Equal<TMode, 'bigint'> extends true ? SQLiteNumericBigIntBuilderInitial<''> : SQLiteNumericBuilderInitial<''>;
|
|
63
|
-
export declare function numeric<TName extends string, TMode extends SQLiteNumericConfig['mode']>(name: TName, config?: SQLiteNumericConfig<TMode>): Equal<TMode, 'number'> extends true ? SQLiteNumericNumberBuilderInitial<TName> : Equal<TMode, 'bigint'> extends true ? SQLiteNumericBigIntBuilderInitial<TName> : SQLiteNumericBuilderInitial<TName>;
|
|
21
|
+
export declare function numeric(): SQLiteNumericBuilderInitial<''>;
|
|
22
|
+
export declare function numeric<TName extends string>(name: TName): SQLiteNumericBuilderInitial<TName>;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { entityKind } from "../../entity.js";
|
|
2
|
-
import { getColumnNameAndConfig } from "../../utils.js";
|
|
3
2
|
import { SQLiteColumn, SQLiteColumnBuilder } from "./common.js";
|
|
4
3
|
class SQLiteNumericBuilder extends SQLiteColumnBuilder {
|
|
5
4
|
static [entityKind] = "SQLiteNumericBuilder";
|
|
@@ -16,73 +15,16 @@ class SQLiteNumericBuilder extends SQLiteColumnBuilder {
|
|
|
16
15
|
}
|
|
17
16
|
class SQLiteNumeric extends SQLiteColumn {
|
|
18
17
|
static [entityKind] = "SQLiteNumeric";
|
|
19
|
-
mapFromDriverValue(value) {
|
|
20
|
-
if (typeof value === "string")
|
|
21
|
-
return value;
|
|
22
|
-
return String(value);
|
|
23
|
-
}
|
|
24
|
-
getSQLType() {
|
|
25
|
-
return "numeric";
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
class SQLiteNumericNumberBuilder extends SQLiteColumnBuilder {
|
|
29
|
-
static [entityKind] = "SQLiteNumericNumberBuilder";
|
|
30
|
-
constructor(name) {
|
|
31
|
-
super(name, "number", "SQLiteNumericNumber");
|
|
32
|
-
}
|
|
33
|
-
/** @internal */
|
|
34
|
-
build(table) {
|
|
35
|
-
return new SQLiteNumericNumber(
|
|
36
|
-
table,
|
|
37
|
-
this.config
|
|
38
|
-
);
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
class SQLiteNumericNumber extends SQLiteColumn {
|
|
42
|
-
static [entityKind] = "SQLiteNumericNumber";
|
|
43
|
-
mapFromDriverValue(value) {
|
|
44
|
-
if (typeof value === "number")
|
|
45
|
-
return value;
|
|
46
|
-
return Number(value);
|
|
47
|
-
}
|
|
48
|
-
mapToDriverValue = String;
|
|
49
|
-
getSQLType() {
|
|
50
|
-
return "numeric";
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
class SQLiteNumericBigIntBuilder extends SQLiteColumnBuilder {
|
|
54
|
-
static [entityKind] = "SQLiteNumericBigIntBuilder";
|
|
55
|
-
constructor(name) {
|
|
56
|
-
super(name, "bigint", "SQLiteNumericBigInt");
|
|
57
|
-
}
|
|
58
|
-
/** @internal */
|
|
59
|
-
build(table) {
|
|
60
|
-
return new SQLiteNumericBigInt(
|
|
61
|
-
table,
|
|
62
|
-
this.config
|
|
63
|
-
);
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
class SQLiteNumericBigInt extends SQLiteColumn {
|
|
67
|
-
static [entityKind] = "SQLiteNumericBigInt";
|
|
68
|
-
mapFromDriverValue = BigInt;
|
|
69
|
-
mapToDriverValue = String;
|
|
70
18
|
getSQLType() {
|
|
71
19
|
return "numeric";
|
|
72
20
|
}
|
|
73
21
|
}
|
|
74
|
-
function numeric(
|
|
75
|
-
|
|
76
|
-
const mode = config?.mode;
|
|
77
|
-
return mode === "number" ? new SQLiteNumericNumberBuilder(name) : mode === "bigint" ? new SQLiteNumericBigIntBuilder(name) : new SQLiteNumericBuilder(name);
|
|
22
|
+
function numeric(name) {
|
|
23
|
+
return new SQLiteNumericBuilder(name ?? "");
|
|
78
24
|
}
|
|
79
25
|
export {
|
|
80
26
|
SQLiteNumeric,
|
|
81
|
-
SQLiteNumericBigInt,
|
|
82
|
-
SQLiteNumericBigIntBuilder,
|
|
83
27
|
SQLiteNumericBuilder,
|
|
84
|
-
SQLiteNumericNumber,
|
|
85
|
-
SQLiteNumericNumberBuilder,
|
|
86
28
|
numeric
|
|
87
29
|
};
|
|
88
30
|
//# sourceMappingURL=numeric.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/sqlite-core/columns/numeric.ts"],"sourcesContent":["import type { ColumnBuilderBaseConfig, ColumnBuilderRuntimeConfig, MakeColumnConfig } from '~/column-builder.ts';\nimport type { ColumnBaseConfig } from '~/column.ts';\nimport { entityKind } from '~/entity.ts';\nimport type { AnySQLiteTable } from '~/sqlite-core/table.ts';\nimport {
|
|
1
|
+
{"version":3,"sources":["../../../src/sqlite-core/columns/numeric.ts"],"sourcesContent":["import type { ColumnBuilderBaseConfig, ColumnBuilderRuntimeConfig, MakeColumnConfig } from '~/column-builder.ts';\nimport type { ColumnBaseConfig } from '~/column.ts';\nimport { entityKind } from '~/entity.ts';\nimport type { AnySQLiteTable } from '~/sqlite-core/table.ts';\nimport { SQLiteColumn, SQLiteColumnBuilder } from './common.ts';\n\nexport type SQLiteNumericBuilderInitial<TName extends string> = SQLiteNumericBuilder<{\n\tname: TName;\n\tdataType: 'string';\n\tcolumnType: 'SQLiteNumeric';\n\tdata: string;\n\tdriverParam: string;\n\tenumValues: undefined;\n}>;\n\nexport class SQLiteNumericBuilder<T extends ColumnBuilderBaseConfig<'string', 'SQLiteNumeric'>>\n\textends SQLiteColumnBuilder<T>\n{\n\tstatic override readonly [entityKind]: string = 'SQLiteNumericBuilder';\n\n\tconstructor(name: T['name']) {\n\t\tsuper(name, 'string', 'SQLiteNumeric');\n\t}\n\n\t/** @internal */\n\toverride build<TTableName extends string>(\n\t\ttable: AnySQLiteTable<{ name: TTableName }>,\n\t): SQLiteNumeric<MakeColumnConfig<T, TTableName>> {\n\t\treturn new SQLiteNumeric<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 SQLiteNumeric<T extends ColumnBaseConfig<'string', 'SQLiteNumeric'>> extends SQLiteColumn<T> {\n\tstatic override readonly [entityKind]: string = 'SQLiteNumeric';\n\n\tgetSQLType(): string {\n\t\treturn 'numeric';\n\t}\n}\n\nexport function numeric(): SQLiteNumericBuilderInitial<''>;\nexport function numeric<TName extends string>(name: TName): SQLiteNumericBuilderInitial<TName>;\nexport function numeric(name?: string) {\n\treturn new SQLiteNumericBuilder(name ?? '');\n}\n"],"mappings":"AAEA,SAAS,kBAAkB;AAE3B,SAAS,cAAc,2BAA2B;AAW3C,MAAM,6BACJ,oBACT;AAAA,EACC,QAA0B,UAAU,IAAY;AAAA,EAEhD,YAAY,MAAiB;AAC5B,UAAM,MAAM,UAAU,eAAe;AAAA,EACtC;AAAA;AAAA,EAGS,MACR,OACiD;AACjD,WAAO,IAAI;AAAA,MACV;AAAA,MACA,KAAK;AAAA,IACN;AAAA,EACD;AACD;AAEO,MAAM,sBAA6E,aAAgB;AAAA,EACzG,QAA0B,UAAU,IAAY;AAAA,EAEhD,aAAqB;AACpB,WAAO;AAAA,EACR;AACD;AAIO,SAAS,QAAQ,MAAe;AACtC,SAAO,IAAI,qBAAqB,QAAQ,EAAE;AAC3C;","names":[]}
|
package/sqlite-core/dialect.cjs
CHANGED
|
@@ -605,11 +605,6 @@ class SQLiteDialect {
|
|
|
605
605
|
case "SQLiteBlobBuffer": {
|
|
606
606
|
return import_sql2.sql`hex(${name}) as ${import_sql2.sql.identifier(key)}`;
|
|
607
607
|
}
|
|
608
|
-
case "SQLiteNumeric":
|
|
609
|
-
case "SQLiteNumericNumber":
|
|
610
|
-
case "SQLiteNumericBigInt": {
|
|
611
|
-
return import_sql2.sql`cast(${name} as text) as ${import_sql2.sql.identifier(key)}`;
|
|
612
|
-
}
|
|
613
608
|
default: {
|
|
614
609
|
return import_sql2.sql`${name} as ${import_sql2.sql.identifier(key)}`;
|
|
615
610
|
}
|