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 CHANGED
@@ -1,5 +1,11 @@
1
1
  # pqb
2
2
 
3
+ ## 0.9.9
4
+
5
+ ### Patch Changes
6
+
7
+ - Override column types via callback
8
+
3
9
  ## 0.9.8
4
10
 
5
11
  ### Patch Changes
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: ct, ...options }: DbOptions<CT>) => DbResult<CT>;
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: ct = 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,