workers-qb 1.13.0 → 1.14.0

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.mts CHANGED
@@ -99,8 +99,8 @@ type SchemaAware<S extends TableSchema, Strict, Loose> = IsEmptySchema<S> extend
99
99
 
100
100
  declare class Raw {
101
101
  isRaw: boolean;
102
- content: any;
103
- constructor(content: any);
102
+ content: string;
103
+ constructor(content: string);
104
104
  }
105
105
  declare class Query<Result = any, IsAsync extends boolean = true> {
106
106
  executeMethod: (query: Query<Result, IsAsync>) => MaybeAsync<IsAsync, Result>;
@@ -174,7 +174,196 @@ declare class SelectBuilder<Schema extends TableSchema = {}, GenericResultWrappe
174
174
  */
175
175
  distinct(columns?: Array<string>): SelectBuilder<Schema, GenericResultWrapper, GenericResult, IsAsync>;
176
176
  where(conditions: string | Array<string>, params?: Primitive | Primitive[]): SelectBuilder<Schema, GenericResultWrapper, GenericResult, IsAsync>;
177
+ /**
178
+ * Add an OR WHERE condition to the query.
179
+ * All previously added WHERE conditions are grouped together and ORed with the new condition.
180
+ * Subsequent `.where()` calls after `.orWhere()` are ANDed as independent conditions.
181
+ *
182
+ * @param conditions - The SQL condition string(s) (can use ? placeholders)
183
+ * @param params - The parameter(s) to bind to the ? placeholders
184
+ *
185
+ * @example
186
+ * // Simple OR condition
187
+ * qb.select('users').where('status = ?', 'active').orWhere('status = ?', 'pending').execute()
188
+ * // SELECT * FROM users WHERE (status = ?) OR (status = ?)
189
+ *
190
+ * @example
191
+ * // Multiple where conditions ORed together
192
+ * qb.select('users')
193
+ * .where('tenant_id = ?', 1)
194
+ * .where('status = ?', 'active')
195
+ * .orWhere('role = ?', 'superadmin')
196
+ * .execute()
197
+ * // SELECT * FROM users WHERE ((tenant_id = ?) AND (status = ?)) OR (role = ?)
198
+ */
199
+ orWhere(conditions: string | Array<string>, params?: Primitive | Primitive[]): SelectBuilder<Schema, GenericResultWrapper, GenericResult, IsAsync>;
177
200
  whereIn<T extends string | Array<string>, P extends T extends Array<string> ? Primitive[][] : Primitive[]>(fields: T, values: P): SelectBuilder<Schema, GenericResultWrapper, GenericResult, IsAsync>;
201
+ /**
202
+ * Conditionally apply query modifications based on a runtime value.
203
+ * If condition is truthy, the callback is invoked with the current builder
204
+ * and its return value is used. If condition is falsy and an otherwise callback
205
+ * is provided, it is invoked instead. Otherwise, the builder is returned unchanged.
206
+ *
207
+ * @param condition - A value to check for truthiness
208
+ * @param callback - Function that receives the builder and returns a modified builder
209
+ * @param otherwise - Optional function applied when condition is falsy
210
+ *
211
+ * @example
212
+ * qb.select('users')
213
+ * .when(nameFilter, q => q.where('name LIKE ?', [`%${nameFilter}%`]))
214
+ * .when(sortByDate, q => q.orderBy({ created_at: 'DESC' }))
215
+ * .execute()
216
+ *
217
+ * @example
218
+ * // With otherwise callback
219
+ * qb.select('products')
220
+ * .when(
221
+ * inStock,
222
+ * q => q.where('stock > ?', 0),
223
+ * q => q.where('stock = ?', 0)
224
+ * )
225
+ * .execute()
226
+ */
227
+ when<T>(condition: T | undefined | null | false | 0 | '', callback: (builder: SelectBuilder<Schema, GenericResultWrapper, GenericResult, IsAsync>) => SelectBuilder<Schema, GenericResultWrapper, GenericResult, IsAsync>, otherwise?: (builder: SelectBuilder<Schema, GenericResultWrapper, GenericResult, IsAsync>) => SelectBuilder<Schema, GenericResultWrapper, GenericResult, IsAsync>): SelectBuilder<Schema, GenericResultWrapper, GenericResult, IsAsync>;
228
+ /**
229
+ * Add a WHERE column IS NULL condition.
230
+ *
231
+ * @param column - The column name to check for NULL
232
+ *
233
+ * @example
234
+ * qb.select('users').whereNull('deleted_at').execute()
235
+ * // SELECT * FROM users WHERE deleted_at IS NULL
236
+ */
237
+ whereNull(column: string): SelectBuilder<Schema, GenericResultWrapper, GenericResult, IsAsync>;
238
+ /**
239
+ * Add a WHERE column IS NOT NULL condition.
240
+ *
241
+ * @param column - The column name to check for NOT NULL
242
+ *
243
+ * @example
244
+ * qb.select('users').whereNotNull('email_verified_at').execute()
245
+ * // SELECT * FROM users WHERE email_verified_at IS NOT NULL
246
+ */
247
+ whereNotNull(column: string): SelectBuilder<Schema, GenericResultWrapper, GenericResult, IsAsync>;
248
+ /**
249
+ * Add a WHERE column BETWEEN min AND max condition.
250
+ *
251
+ * @param column - The column name
252
+ * @param range - Tuple of [min, max] values
253
+ *
254
+ * @example
255
+ * qb.select('products').whereBetween('price', [10, 100]).execute()
256
+ * // SELECT * FROM products WHERE price BETWEEN ? AND ?
257
+ */
258
+ whereBetween(column: string, range: [Primitive, Primitive]): SelectBuilder<Schema, GenericResultWrapper, GenericResult, IsAsync>;
259
+ /**
260
+ * Add a WHERE column NOT BETWEEN min AND max condition.
261
+ *
262
+ * @param column - The column name
263
+ * @param range - Tuple of [min, max] values
264
+ *
265
+ * @example
266
+ * qb.select('products').whereNotBetween('price', [10, 100]).execute()
267
+ * // SELECT * FROM products WHERE price NOT BETWEEN ? AND ?
268
+ */
269
+ whereNotBetween(column: string, range: [Primitive, Primitive]): SelectBuilder<Schema, GenericResultWrapper, GenericResult, IsAsync>;
270
+ /**
271
+ * Add an OR WHERE column IS NULL condition.
272
+ *
273
+ * @param column - The column name to check for NULL
274
+ *
275
+ * @example
276
+ * qb.select('users').where('active = ?', true).orWhereNull('deleted_at').execute()
277
+ * // SELECT * FROM users WHERE (active = ?) OR (deleted_at IS NULL)
278
+ */
279
+ orWhereNull(column: string): SelectBuilder<Schema, GenericResultWrapper, GenericResult, IsAsync>;
280
+ /**
281
+ * Add an OR WHERE column IS NOT NULL condition.
282
+ *
283
+ * @param column - The column name to check for NOT NULL
284
+ *
285
+ * @example
286
+ * qb.select('users').whereNull('deleted_at').orWhereNotNull('verified_at').execute()
287
+ * // SELECT * FROM users WHERE (deleted_at IS NULL) OR (verified_at IS NOT NULL)
288
+ */
289
+ orWhereNotNull(column: string): SelectBuilder<Schema, GenericResultWrapper, GenericResult, IsAsync>;
290
+ /**
291
+ * Add an OR WHERE column BETWEEN min AND max condition.
292
+ *
293
+ * @param column - The column name
294
+ * @param range - Tuple of [min, max] values
295
+ *
296
+ * @example
297
+ * qb.select('products').where('active = ?', true).orWhereBetween('price', [10, 100]).execute()
298
+ * // SELECT * FROM products WHERE (active = ?) OR (price BETWEEN ? AND ?)
299
+ */
300
+ orWhereBetween(column: string, range: [Primitive, Primitive]): SelectBuilder<Schema, GenericResultWrapper, GenericResult, IsAsync>;
301
+ /**
302
+ * Add an OR WHERE column NOT BETWEEN min AND max condition.
303
+ *
304
+ * @param column - The column name
305
+ * @param range - Tuple of [min, max] values
306
+ *
307
+ * @example
308
+ * qb.select('products').where('featured = ?', true).orWhereNotBetween('price', [10, 100]).execute()
309
+ * // SELECT * FROM products WHERE (featured = ?) OR (price NOT BETWEEN ? AND ?)
310
+ */
311
+ orWhereNotBetween(column: string, range: [Primitive, Primitive]): SelectBuilder<Schema, GenericResultWrapper, GenericResult, IsAsync>;
312
+ /**
313
+ * Add a WHERE column LIKE pattern condition.
314
+ *
315
+ * @param column - The column name
316
+ * @param pattern - The LIKE pattern (e.g., '%search%')
317
+ *
318
+ * @example
319
+ * qb.select('users').whereLike('name', '%john%').execute()
320
+ * // SELECT * FROM users WHERE name LIKE ?
321
+ */
322
+ whereLike(column: string, pattern: string): SelectBuilder<Schema, GenericResultWrapper, GenericResult, IsAsync>;
323
+ /**
324
+ * Add a WHERE column NOT LIKE pattern condition.
325
+ *
326
+ * @param column - The column name
327
+ * @param pattern - The LIKE pattern
328
+ *
329
+ * @example
330
+ * qb.select('users').whereNotLike('email', '%@spam.com').execute()
331
+ * // SELECT * FROM users WHERE email NOT LIKE ?
332
+ */
333
+ whereNotLike(column: string, pattern: string): SelectBuilder<Schema, GenericResultWrapper, GenericResult, IsAsync>;
334
+ /**
335
+ * Add an OR WHERE column LIKE pattern condition.
336
+ *
337
+ * @param column - The column name
338
+ * @param pattern - The LIKE pattern (e.g., '%search%')
339
+ *
340
+ * @example
341
+ * qb.select('users').whereLike('name', '%john%').orWhereLike('email', '%john%').execute()
342
+ * // SELECT * FROM users WHERE (name LIKE ?) OR (email LIKE ?)
343
+ */
344
+ orWhereLike(column: string, pattern: string): SelectBuilder<Schema, GenericResultWrapper, GenericResult, IsAsync>;
345
+ /**
346
+ * Add an OR WHERE column NOT LIKE pattern condition.
347
+ *
348
+ * @param column - The column name
349
+ * @param pattern - The LIKE pattern
350
+ *
351
+ * @example
352
+ * qb.select('users').where('active = ?', true).orWhereNotLike('email', '%@spam.com').execute()
353
+ * // SELECT * FROM users WHERE (active = ?) OR (email NOT LIKE ?)
354
+ */
355
+ orWhereNotLike(column: string, pattern: string): SelectBuilder<Schema, GenericResultWrapper, GenericResult, IsAsync>;
356
+ /**
357
+ * Add a WHERE column NOT IN (values) condition.
358
+ *
359
+ * @param fields - Column name(s) to check
360
+ * @param values - Values to exclude
361
+ *
362
+ * @example
363
+ * qb.select('users').whereNotIn('status', ['banned', 'suspended']).execute()
364
+ * // SELECT * FROM users WHERE (status) NOT IN (VALUES (?), (?))
365
+ */
366
+ whereNotIn<T extends string | Array<string>, P extends T extends Array<string> ? Primitive[][] : Primitive[]>(fields: T, values: P): SelectBuilder<Schema, GenericResultWrapper, GenericResult, IsAsync>;
178
367
  join(join: SelectAll['join']): SelectBuilder<Schema, GenericResultWrapper, GenericResult, IsAsync>;
179
368
  /**
180
369
  * Add an INNER JOIN to the query.
@@ -626,9 +815,10 @@ type TypedDelete<S extends TableSchema, T extends TableName<S>> = {
626
815
  */
627
816
  type InferResult<S extends TableSchema, T extends TableName<S>, F> = F extends '*' ? S[T] : F extends ColumnName<S, T>[] ? Pick<S[T], F[number]> : F extends ColumnName<S, T> ? Pick<S[T], F> : S[T];
628
817
 
818
+ type LoggerFunction = (query: RawQuery, meta: QueryLoggerMeta) => void | Promise<void>;
629
819
  declare function defaultLogger(query: RawQuery, meta: QueryLoggerMeta): any;
630
- declare function asyncLoggerWrapper<Async extends boolean = true>(query: Query<any, Async> | Query<any, Async>[], loggerFunction: CallableFunction | undefined, innerFunction: () => any): Promise<any>;
631
- declare function syncLoggerWrapper<Async extends boolean = false>(query: Query<any, Async> | Query<any, Async>[], loggerFunction: CallableFunction | undefined, innerFunction: () => any): any;
820
+ declare function asyncLoggerWrapper<Async extends boolean = true>(query: Query<any, Async> | Query<any, Async>[], loggerFunction: LoggerFunction | undefined, innerFunction: () => any): Promise<any>;
821
+ declare function syncLoggerWrapper<Async extends boolean = false>(query: Query<any, Async> | Query<any, Async>[], loggerFunction: LoggerFunction | undefined, innerFunction: () => any): any;
632
822
 
633
823
  declare class QueryBuilder<Schema extends TableSchema = {}, GenericResultWrapper = unknown, IsAsync extends boolean = true> {
634
824
  protected options: QueryBuilderOptions<IsAsync>;
@@ -828,11 +1018,17 @@ declare class DOQB<Schema extends TableSchema = {}> extends QueryBuilder<Schema,
828
1018
  transaction<T>(callback: (tx: DOQB<Schema>) => T): T;
829
1019
  }
830
1020
 
1021
+ declare class PGMigrationsBuilder extends asyncMigrationsBuilder<PGResult> {
1022
+ initialize(): Promise<void>;
1023
+ apply(): Promise<Array<{
1024
+ name: string;
1025
+ sql: string;
1026
+ }>>;
1027
+ }
831
1028
  declare class PGQB<Schema extends TableSchema = {}> extends QueryBuilder<Schema, PGResult, true> {
832
1029
  db: any;
833
- _migrationsBuilder: typeof asyncMigrationsBuilder;
834
1030
  constructor(db: any, options?: QueryBuilderOptions);
835
- migrations(options: MigrationOptions): asyncMigrationsBuilder<PGResult>;
1031
+ migrations(options: MigrationOptions): PGMigrationsBuilder;
836
1032
  connect(): Promise<void>;
837
1033
  close(): Promise<void>;
838
1034
  execute(query: Query): Promise<any>;
package/dist/index.d.ts CHANGED
@@ -99,8 +99,8 @@ type SchemaAware<S extends TableSchema, Strict, Loose> = IsEmptySchema<S> extend
99
99
 
100
100
  declare class Raw {
101
101
  isRaw: boolean;
102
- content: any;
103
- constructor(content: any);
102
+ content: string;
103
+ constructor(content: string);
104
104
  }
105
105
  declare class Query<Result = any, IsAsync extends boolean = true> {
106
106
  executeMethod: (query: Query<Result, IsAsync>) => MaybeAsync<IsAsync, Result>;
@@ -174,7 +174,196 @@ declare class SelectBuilder<Schema extends TableSchema = {}, GenericResultWrappe
174
174
  */
175
175
  distinct(columns?: Array<string>): SelectBuilder<Schema, GenericResultWrapper, GenericResult, IsAsync>;
176
176
  where(conditions: string | Array<string>, params?: Primitive | Primitive[]): SelectBuilder<Schema, GenericResultWrapper, GenericResult, IsAsync>;
177
+ /**
178
+ * Add an OR WHERE condition to the query.
179
+ * All previously added WHERE conditions are grouped together and ORed with the new condition.
180
+ * Subsequent `.where()` calls after `.orWhere()` are ANDed as independent conditions.
181
+ *
182
+ * @param conditions - The SQL condition string(s) (can use ? placeholders)
183
+ * @param params - The parameter(s) to bind to the ? placeholders
184
+ *
185
+ * @example
186
+ * // Simple OR condition
187
+ * qb.select('users').where('status = ?', 'active').orWhere('status = ?', 'pending').execute()
188
+ * // SELECT * FROM users WHERE (status = ?) OR (status = ?)
189
+ *
190
+ * @example
191
+ * // Multiple where conditions ORed together
192
+ * qb.select('users')
193
+ * .where('tenant_id = ?', 1)
194
+ * .where('status = ?', 'active')
195
+ * .orWhere('role = ?', 'superadmin')
196
+ * .execute()
197
+ * // SELECT * FROM users WHERE ((tenant_id = ?) AND (status = ?)) OR (role = ?)
198
+ */
199
+ orWhere(conditions: string | Array<string>, params?: Primitive | Primitive[]): SelectBuilder<Schema, GenericResultWrapper, GenericResult, IsAsync>;
177
200
  whereIn<T extends string | Array<string>, P extends T extends Array<string> ? Primitive[][] : Primitive[]>(fields: T, values: P): SelectBuilder<Schema, GenericResultWrapper, GenericResult, IsAsync>;
201
+ /**
202
+ * Conditionally apply query modifications based on a runtime value.
203
+ * If condition is truthy, the callback is invoked with the current builder
204
+ * and its return value is used. If condition is falsy and an otherwise callback
205
+ * is provided, it is invoked instead. Otherwise, the builder is returned unchanged.
206
+ *
207
+ * @param condition - A value to check for truthiness
208
+ * @param callback - Function that receives the builder and returns a modified builder
209
+ * @param otherwise - Optional function applied when condition is falsy
210
+ *
211
+ * @example
212
+ * qb.select('users')
213
+ * .when(nameFilter, q => q.where('name LIKE ?', [`%${nameFilter}%`]))
214
+ * .when(sortByDate, q => q.orderBy({ created_at: 'DESC' }))
215
+ * .execute()
216
+ *
217
+ * @example
218
+ * // With otherwise callback
219
+ * qb.select('products')
220
+ * .when(
221
+ * inStock,
222
+ * q => q.where('stock > ?', 0),
223
+ * q => q.where('stock = ?', 0)
224
+ * )
225
+ * .execute()
226
+ */
227
+ when<T>(condition: T | undefined | null | false | 0 | '', callback: (builder: SelectBuilder<Schema, GenericResultWrapper, GenericResult, IsAsync>) => SelectBuilder<Schema, GenericResultWrapper, GenericResult, IsAsync>, otherwise?: (builder: SelectBuilder<Schema, GenericResultWrapper, GenericResult, IsAsync>) => SelectBuilder<Schema, GenericResultWrapper, GenericResult, IsAsync>): SelectBuilder<Schema, GenericResultWrapper, GenericResult, IsAsync>;
228
+ /**
229
+ * Add a WHERE column IS NULL condition.
230
+ *
231
+ * @param column - The column name to check for NULL
232
+ *
233
+ * @example
234
+ * qb.select('users').whereNull('deleted_at').execute()
235
+ * // SELECT * FROM users WHERE deleted_at IS NULL
236
+ */
237
+ whereNull(column: string): SelectBuilder<Schema, GenericResultWrapper, GenericResult, IsAsync>;
238
+ /**
239
+ * Add a WHERE column IS NOT NULL condition.
240
+ *
241
+ * @param column - The column name to check for NOT NULL
242
+ *
243
+ * @example
244
+ * qb.select('users').whereNotNull('email_verified_at').execute()
245
+ * // SELECT * FROM users WHERE email_verified_at IS NOT NULL
246
+ */
247
+ whereNotNull(column: string): SelectBuilder<Schema, GenericResultWrapper, GenericResult, IsAsync>;
248
+ /**
249
+ * Add a WHERE column BETWEEN min AND max condition.
250
+ *
251
+ * @param column - The column name
252
+ * @param range - Tuple of [min, max] values
253
+ *
254
+ * @example
255
+ * qb.select('products').whereBetween('price', [10, 100]).execute()
256
+ * // SELECT * FROM products WHERE price BETWEEN ? AND ?
257
+ */
258
+ whereBetween(column: string, range: [Primitive, Primitive]): SelectBuilder<Schema, GenericResultWrapper, GenericResult, IsAsync>;
259
+ /**
260
+ * Add a WHERE column NOT BETWEEN min AND max condition.
261
+ *
262
+ * @param column - The column name
263
+ * @param range - Tuple of [min, max] values
264
+ *
265
+ * @example
266
+ * qb.select('products').whereNotBetween('price', [10, 100]).execute()
267
+ * // SELECT * FROM products WHERE price NOT BETWEEN ? AND ?
268
+ */
269
+ whereNotBetween(column: string, range: [Primitive, Primitive]): SelectBuilder<Schema, GenericResultWrapper, GenericResult, IsAsync>;
270
+ /**
271
+ * Add an OR WHERE column IS NULL condition.
272
+ *
273
+ * @param column - The column name to check for NULL
274
+ *
275
+ * @example
276
+ * qb.select('users').where('active = ?', true).orWhereNull('deleted_at').execute()
277
+ * // SELECT * FROM users WHERE (active = ?) OR (deleted_at IS NULL)
278
+ */
279
+ orWhereNull(column: string): SelectBuilder<Schema, GenericResultWrapper, GenericResult, IsAsync>;
280
+ /**
281
+ * Add an OR WHERE column IS NOT NULL condition.
282
+ *
283
+ * @param column - The column name to check for NOT NULL
284
+ *
285
+ * @example
286
+ * qb.select('users').whereNull('deleted_at').orWhereNotNull('verified_at').execute()
287
+ * // SELECT * FROM users WHERE (deleted_at IS NULL) OR (verified_at IS NOT NULL)
288
+ */
289
+ orWhereNotNull(column: string): SelectBuilder<Schema, GenericResultWrapper, GenericResult, IsAsync>;
290
+ /**
291
+ * Add an OR WHERE column BETWEEN min AND max condition.
292
+ *
293
+ * @param column - The column name
294
+ * @param range - Tuple of [min, max] values
295
+ *
296
+ * @example
297
+ * qb.select('products').where('active = ?', true).orWhereBetween('price', [10, 100]).execute()
298
+ * // SELECT * FROM products WHERE (active = ?) OR (price BETWEEN ? AND ?)
299
+ */
300
+ orWhereBetween(column: string, range: [Primitive, Primitive]): SelectBuilder<Schema, GenericResultWrapper, GenericResult, IsAsync>;
301
+ /**
302
+ * Add an OR WHERE column NOT BETWEEN min AND max condition.
303
+ *
304
+ * @param column - The column name
305
+ * @param range - Tuple of [min, max] values
306
+ *
307
+ * @example
308
+ * qb.select('products').where('featured = ?', true).orWhereNotBetween('price', [10, 100]).execute()
309
+ * // SELECT * FROM products WHERE (featured = ?) OR (price NOT BETWEEN ? AND ?)
310
+ */
311
+ orWhereNotBetween(column: string, range: [Primitive, Primitive]): SelectBuilder<Schema, GenericResultWrapper, GenericResult, IsAsync>;
312
+ /**
313
+ * Add a WHERE column LIKE pattern condition.
314
+ *
315
+ * @param column - The column name
316
+ * @param pattern - The LIKE pattern (e.g., '%search%')
317
+ *
318
+ * @example
319
+ * qb.select('users').whereLike('name', '%john%').execute()
320
+ * // SELECT * FROM users WHERE name LIKE ?
321
+ */
322
+ whereLike(column: string, pattern: string): SelectBuilder<Schema, GenericResultWrapper, GenericResult, IsAsync>;
323
+ /**
324
+ * Add a WHERE column NOT LIKE pattern condition.
325
+ *
326
+ * @param column - The column name
327
+ * @param pattern - The LIKE pattern
328
+ *
329
+ * @example
330
+ * qb.select('users').whereNotLike('email', '%@spam.com').execute()
331
+ * // SELECT * FROM users WHERE email NOT LIKE ?
332
+ */
333
+ whereNotLike(column: string, pattern: string): SelectBuilder<Schema, GenericResultWrapper, GenericResult, IsAsync>;
334
+ /**
335
+ * Add an OR WHERE column LIKE pattern condition.
336
+ *
337
+ * @param column - The column name
338
+ * @param pattern - The LIKE pattern (e.g., '%search%')
339
+ *
340
+ * @example
341
+ * qb.select('users').whereLike('name', '%john%').orWhereLike('email', '%john%').execute()
342
+ * // SELECT * FROM users WHERE (name LIKE ?) OR (email LIKE ?)
343
+ */
344
+ orWhereLike(column: string, pattern: string): SelectBuilder<Schema, GenericResultWrapper, GenericResult, IsAsync>;
345
+ /**
346
+ * Add an OR WHERE column NOT LIKE pattern condition.
347
+ *
348
+ * @param column - The column name
349
+ * @param pattern - The LIKE pattern
350
+ *
351
+ * @example
352
+ * qb.select('users').where('active = ?', true).orWhereNotLike('email', '%@spam.com').execute()
353
+ * // SELECT * FROM users WHERE (active = ?) OR (email NOT LIKE ?)
354
+ */
355
+ orWhereNotLike(column: string, pattern: string): SelectBuilder<Schema, GenericResultWrapper, GenericResult, IsAsync>;
356
+ /**
357
+ * Add a WHERE column NOT IN (values) condition.
358
+ *
359
+ * @param fields - Column name(s) to check
360
+ * @param values - Values to exclude
361
+ *
362
+ * @example
363
+ * qb.select('users').whereNotIn('status', ['banned', 'suspended']).execute()
364
+ * // SELECT * FROM users WHERE (status) NOT IN (VALUES (?), (?))
365
+ */
366
+ whereNotIn<T extends string | Array<string>, P extends T extends Array<string> ? Primitive[][] : Primitive[]>(fields: T, values: P): SelectBuilder<Schema, GenericResultWrapper, GenericResult, IsAsync>;
178
367
  join(join: SelectAll['join']): SelectBuilder<Schema, GenericResultWrapper, GenericResult, IsAsync>;
179
368
  /**
180
369
  * Add an INNER JOIN to the query.
@@ -626,9 +815,10 @@ type TypedDelete<S extends TableSchema, T extends TableName<S>> = {
626
815
  */
627
816
  type InferResult<S extends TableSchema, T extends TableName<S>, F> = F extends '*' ? S[T] : F extends ColumnName<S, T>[] ? Pick<S[T], F[number]> : F extends ColumnName<S, T> ? Pick<S[T], F> : S[T];
628
817
 
818
+ type LoggerFunction = (query: RawQuery, meta: QueryLoggerMeta) => void | Promise<void>;
629
819
  declare function defaultLogger(query: RawQuery, meta: QueryLoggerMeta): any;
630
- declare function asyncLoggerWrapper<Async extends boolean = true>(query: Query<any, Async> | Query<any, Async>[], loggerFunction: CallableFunction | undefined, innerFunction: () => any): Promise<any>;
631
- declare function syncLoggerWrapper<Async extends boolean = false>(query: Query<any, Async> | Query<any, Async>[], loggerFunction: CallableFunction | undefined, innerFunction: () => any): any;
820
+ declare function asyncLoggerWrapper<Async extends boolean = true>(query: Query<any, Async> | Query<any, Async>[], loggerFunction: LoggerFunction | undefined, innerFunction: () => any): Promise<any>;
821
+ declare function syncLoggerWrapper<Async extends boolean = false>(query: Query<any, Async> | Query<any, Async>[], loggerFunction: LoggerFunction | undefined, innerFunction: () => any): any;
632
822
 
633
823
  declare class QueryBuilder<Schema extends TableSchema = {}, GenericResultWrapper = unknown, IsAsync extends boolean = true> {
634
824
  protected options: QueryBuilderOptions<IsAsync>;
@@ -828,11 +1018,17 @@ declare class DOQB<Schema extends TableSchema = {}> extends QueryBuilder<Schema,
828
1018
  transaction<T>(callback: (tx: DOQB<Schema>) => T): T;
829
1019
  }
830
1020
 
1021
+ declare class PGMigrationsBuilder extends asyncMigrationsBuilder<PGResult> {
1022
+ initialize(): Promise<void>;
1023
+ apply(): Promise<Array<{
1024
+ name: string;
1025
+ sql: string;
1026
+ }>>;
1027
+ }
831
1028
  declare class PGQB<Schema extends TableSchema = {}> extends QueryBuilder<Schema, PGResult, true> {
832
1029
  db: any;
833
- _migrationsBuilder: typeof asyncMigrationsBuilder;
834
1030
  constructor(db: any, options?: QueryBuilderOptions);
835
- migrations(options: MigrationOptions): asyncMigrationsBuilder<PGResult>;
1031
+ migrations(options: MigrationOptions): PGMigrationsBuilder;
836
1032
  connect(): Promise<void>;
837
1033
  close(): Promise<void>;
838
1034
  execute(query: Query): Promise<any>;