pqb 0.9.8 → 0.9.9
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/CHANGELOG.md +6 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/columnSchema/columnType.test.ts +4 -4
- package/src/db.test.ts +4 -5
- package/src/db.ts +4 -2
- package/src/test-utils/test-utils.ts +5 -6
package/CHANGELOG.md
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -811,7 +811,7 @@ declare type NoPrimaryKeyOption = 'error' | 'warning' | 'ignore';
|
|
|
811
811
|
declare type DbOptions<CT extends ColumnTypesBase> = ({
|
|
812
812
|
adapter: Adapter;
|
|
813
813
|
} | Omit<AdapterOptions, 'log'>) & QueryLogOptions & {
|
|
814
|
-
columnTypes?: CT;
|
|
814
|
+
columnTypes?: CT | ((t: DefaultColumnTypes) => CT);
|
|
815
815
|
autoPreparedStatements?: boolean;
|
|
816
816
|
noPrimaryKey?: NoPrimaryKeyOption;
|
|
817
817
|
};
|
|
@@ -880,7 +880,7 @@ declare type DbResult<CT extends ColumnTypesBase> = Db<string, Record<string, ne
|
|
|
880
880
|
adapter: Adapter;
|
|
881
881
|
close: Adapter['close'];
|
|
882
882
|
};
|
|
883
|
-
declare const createDb: <CT extends ColumnTypesBase>({ log, logger, columnTypes:
|
|
883
|
+
declare const createDb: <CT extends ColumnTypesBase>({ log, logger, columnTypes: ctOrFn, ...options }: DbOptions<CT>) => DbResult<CT>;
|
|
884
884
|
|
|
885
885
|
declare type WithArgsOptions = Omit<WithOptions, 'columns'> & {
|
|
886
886
|
columns?: boolean | string[];
|
package/dist/index.js
CHANGED
|
@@ -6677,7 +6677,7 @@ const createDb = (_a) => {
|
|
|
6677
6677
|
var _b = _a, {
|
|
6678
6678
|
log,
|
|
6679
6679
|
logger,
|
|
6680
|
-
columnTypes:
|
|
6680
|
+
columnTypes: ctOrFn = columnTypes
|
|
6681
6681
|
} = _b, options = __objRest(_b, [
|
|
6682
6682
|
"log",
|
|
6683
6683
|
"logger",
|
|
@@ -6691,6 +6691,7 @@ const createDb = (_a) => {
|
|
|
6691
6691
|
autoPreparedStatements: (_a2 = options.autoPreparedStatements) != null ? _a2 : false,
|
|
6692
6692
|
noPrimaryKey: (_b2 = options.noPrimaryKey) != null ? _b2 : "error"
|
|
6693
6693
|
};
|
|
6694
|
+
const ct = typeof ctOrFn === "function" ? ctOrFn(columnTypes) : ctOrFn;
|
|
6694
6695
|
const qb = new Db(
|
|
6695
6696
|
adapter,
|
|
6696
6697
|
void 0,
|