pqb 0.18.17 → 0.18.19
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/dist/index.d.ts +366 -746
- package/dist/index.js +19 -23
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +19 -23
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
|
@@ -3378,6 +3378,7 @@ class JSONColumn extends ColumnType {
|
|
|
3378
3378
|
);
|
|
3379
3379
|
}
|
|
3380
3380
|
}
|
|
3381
|
+
JSONColumn.prototype.encodeFn = JSON.stringify;
|
|
3381
3382
|
class JSONTextColumn extends ColumnType {
|
|
3382
3383
|
constructor() {
|
|
3383
3384
|
super(...arguments);
|
|
@@ -3388,7 +3389,6 @@ class JSONTextColumn extends ColumnType {
|
|
|
3388
3389
|
return columnCode(this, t, `jsonText()`, this.data, toCodeSkip);
|
|
3389
3390
|
}
|
|
3390
3391
|
}
|
|
3391
|
-
JSONColumn.prototype.encodeFn = JSONTextColumn.prototype.encodeFn = JSON.stringify;
|
|
3392
3392
|
|
|
3393
3393
|
class ArrayColumn extends ColumnType {
|
|
3394
3394
|
constructor(item) {
|
|
@@ -3549,22 +3549,22 @@ const getColumnTypes = (types, fn, nowSQL, language, data = newTableData()) => {
|
|
|
3549
3549
|
resetTableData(data);
|
|
3550
3550
|
return fn(types);
|
|
3551
3551
|
};
|
|
3552
|
-
function sql(...args) {
|
|
3553
|
-
const arg = args[0];
|
|
3554
|
-
if (Array.isArray(arg)) {
|
|
3555
|
-
return new RawSQL(args);
|
|
3556
|
-
}
|
|
3557
|
-
if (typeof args[0] === "string") {
|
|
3558
|
-
return new RawSQL(args[0]);
|
|
3559
|
-
}
|
|
3560
|
-
if (args[1] !== void 0) {
|
|
3561
|
-
return new RawSQL(args[1], arg);
|
|
3562
|
-
}
|
|
3563
|
-
return (...args2) => new RawSQL(args2, arg);
|
|
3564
|
-
}
|
|
3565
3552
|
const columnTypes = __spreadValues$9({
|
|
3566
3553
|
name,
|
|
3567
|
-
|
|
3554
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
3555
|
+
sql(...args) {
|
|
3556
|
+
const arg = args[0];
|
|
3557
|
+
if (Array.isArray(arg)) {
|
|
3558
|
+
return new RawSQL(args);
|
|
3559
|
+
}
|
|
3560
|
+
if (typeof args[0] === "string") {
|
|
3561
|
+
return new RawSQL(args[0]);
|
|
3562
|
+
}
|
|
3563
|
+
if (args[1] !== void 0) {
|
|
3564
|
+
return new RawSQL(args[1], arg);
|
|
3565
|
+
}
|
|
3566
|
+
return (...args2) => new RawSQL(args2, arg);
|
|
3567
|
+
},
|
|
3568
3568
|
smallint() {
|
|
3569
3569
|
return new SmallIntColumn();
|
|
3570
3570
|
},
|
|
@@ -3610,7 +3610,6 @@ const columnTypes = __spreadValues$9({
|
|
|
3610
3610
|
text(min, max) {
|
|
3611
3611
|
return new TextColumn(min, max);
|
|
3612
3612
|
},
|
|
3613
|
-
// `varchar` column with optional limit defaulting to 255.
|
|
3614
3613
|
string(limit = 255) {
|
|
3615
3614
|
return new VarCharColumn(limit);
|
|
3616
3615
|
},
|
|
@@ -3731,12 +3730,7 @@ const columnTypes = __spreadValues$9({
|
|
|
3731
3730
|
searchIndex(columns, options) {
|
|
3732
3731
|
return this.index(columns, __spreadProps$5(__spreadValues$9({}, options), { tsVector: true }));
|
|
3733
3732
|
},
|
|
3734
|
-
constraint({
|
|
3735
|
-
name: name2,
|
|
3736
|
-
references,
|
|
3737
|
-
check,
|
|
3738
|
-
dropMode
|
|
3739
|
-
}) {
|
|
3733
|
+
constraint({ name: name2, references, check, dropMode }) {
|
|
3740
3734
|
var _a;
|
|
3741
3735
|
((_a = tableData.constraints) != null ? _a : tableData.constraints = []).push({
|
|
3742
3736
|
name: name2,
|
|
@@ -10191,7 +10185,9 @@ const createDb = (_a) => {
|
|
|
10191
10185
|
noPrimaryKey: (_b2 = options.noPrimaryKey) != null ? _b2 : "error",
|
|
10192
10186
|
snakeCase
|
|
10193
10187
|
};
|
|
10194
|
-
const ct = typeof ctOrFn === "function" ? ctOrFn(
|
|
10188
|
+
const ct = typeof ctOrFn === "function" ? ctOrFn(
|
|
10189
|
+
columnTypes
|
|
10190
|
+
) : ctOrFn;
|
|
10195
10191
|
if (snakeCase) {
|
|
10196
10192
|
ct[snakeCaseKey] = true;
|
|
10197
10193
|
}
|