UNPKG

25.7 kBTypeScriptView Raw
1/// <reference types="node" />
2declare module '@ioc:Adonis/Lucid/Database' {
3 import { Knex } from 'knex';
4 import { DialectContract, QueryClientContract, TransactionClientContract } from '@ioc:Adonis/Lucid/Database';
5 /**
6 * Extracted from ts-essentials
7 */
8 type Dictionary<T, K extends string | number = string> = {
9 [key in K]: T;
10 };
11 /**
12 * Get one or many of a generic
13 */
14 type OneOrMany<T> = T | T[];
15 /**
16 * Allowing a generic value along with raw query instance or a subquery
17 * instance
18 */
19 type ValueWithSubQueries<T> = T | ChainableContract | RawQuery;
20 /**
21 * Acceptable raw queries
22 */
23 type RawQuery = RawBuilderContract | RawQueryBuilderContract | Knex.Raw | Knex.RawQueryBuilder;
24 /**
25 * A known set of values allowed when defining values for different
26 * clauses
27 */
28 type StrictValues = string | number | boolean | Date | Array<string> | Array<number> | Array<Date> | Array<boolean> | Buffer | RawQuery | ReferenceBuilderContract;
29 /**
30 * Strict set of allowed values except the raw queries
31 */
32 type StrictValuesWithoutRaw = Exclude<StrictValues, RawQuery>;
33 /**
34 * Shape of raw query bindings
35 */
36 type RawQueryBindings = {
37 [key: string]: StrictValues;
38 } | StrictValues[];
39 /**
40 * A builder method to allow raw queries. However, the return type is the
41 * instance of current query builder. This is used for `.{verb}Raw` methods.
42 */
43 interface RawQueryFn<Builder extends ChainableContract> {
44 (sql: string | RawQuery): Builder;
45 (sql: string, bindings: RawQueryBindings): Builder;
46 }
47 /**
48 * Query callback is used to write wrapped queries. We get rid of `this` from
49 * knex, since it makes everything confusing.
50 */
51 type QueryCallback<Builder> = (builder: Builder) => void;
52 /**
53 * Shape of the function accepted by the chainable query builder to
54 * pass lucid query builder to wrapped callbacks like
55 * `.where(function () {})`.
56 *
57 * - This method will accept the wrapped callback
58 * - Return a new method, that is accepted by Knex.
59 * - When knex calls that method, this method will invoke the user wrapped
60 * callback, but instead of passing the knex query builder, it will
61 * pass the appropriate lucid query builder.
62 */
63 type DBQueryCallback = (userFn: QueryCallback<ChainableContract>, keysResolver?: (columnName: string) => string) => (builder: Knex.QueryBuilder) => void;
64 /**
65 * Possible signatures for a select method on database query builder.
66 */
67 interface DatabaseQueryBuilderSelect<Builder extends ChainableContract> {
68 /**
69 * Selecting columns as a dictionary with key as the alias and value is
70 * the original column.
71 */
72 (columns: Dictionary<string, string>): Builder;
73 /**
74 * An array of values with subqueries
75 */
76 (columns: ValueWithSubQueries<string | number>[]): Builder;
77 /**
78 * A spread of array arguments
79 */
80 (...columns: ValueWithSubQueries<string | number>[]): Builder;
81 /**
82 * Wildcard selector.
83 */
84 (column: '*'): Builder;
85 }
86 /**
87 * Possible signatures for adding a where clause
88 */
89 interface Where<Builder extends ChainableContract> {
90 /**
91 * Callback for wrapped clauses
92 */
93 (callback: QueryCallback<Builder>): Builder;
94 /**
95 * Passing an object of named key-value pair
96 */
97 (clause: Dictionary<any, string>): Builder;
98 /**
99 * Key-value pair. The value can also be a subquery
100 */
101 (key: string | RawQuery, value: StrictValues | ChainableContract): Builder;
102 (key: string | RawQuery, operator: string, value: StrictValues | ChainableContract): Builder;
103 }
104 /**
105 * Possible signatures for adding a whereLike clause
106 */
107 interface WhereLike<Builder extends ChainableContract> {
108 /**
109 * Key-value pair. The value can also be a subquery
110 */
111 (key: string, value: StrictValues | ChainableContract): Builder;
112 }
113 /**
114 * Possible signatures for adding a whereLike clause
115 */
116 interface WhereJson<Builder extends ChainableContract> {
117 /**
118 * Key-value pair. The value can also be a subquery
119 */
120 (column: string, value: Record<string, any> | ChainableContract | QueryCallback<Builder>): Builder;
121 }
122 interface WhereJsonPath<Builder extends ChainableContract> {
123 (column: string, jsonPath: string, value: string | number | boolean | string[] | number[] | boolean[] | Record<string, any> | ChainableContract | QueryCallback<Builder>): Builder;
124 (column: string, jsonPath: string, operator: string, value: string | number | boolean | string[] | number[] | boolean[] | Record<string, any> | ChainableContract | QueryCallback<Builder>): Builder;
125 }
126 /**
127 * Possible signatures for adding a where column clause
128 */
129 interface WhereColumn<Builder extends ChainableContract> {
130 /**
131 * Key-value pair.
132 */
133 (column: string | RawQuery, comparisonColumn: string): Builder;
134 (column: string | RawQuery, operator: string, comparisonColumn: string): Builder;
135 }
136 /**
137 * Possible signatures for adding where in clause.
138 */
139 interface WhereIn<Builder extends ChainableContract> {
140 /**
141 * Column name and array of values
142 */
143 (K: string | RawQuery, value: StrictValues[]): Builder;
144 /**
145 * Column names and array of values as an 2d array
146 */
147 (K: string[], value: StrictValues[][]): Builder;
148 /**
149 * Column name with a subquery for a callback that yields an array of
150 * results
151 */
152 (k: string | RawQuery, subquery: ChainableContract | QueryCallback<Builder> | RawBuilderContract | RawQuery): Builder;
153 /**
154 * Column names along with a subquery that yields an array
155 */
156 (k: string[], subquery: ChainableContract | RawBuilderContract | RawQuery): Builder;
157 }
158 /**
159 * Possible signatures for adding whereNull clause.
160 */
161 interface WhereNull<Builder extends ChainableContract> {
162 (key: string | RawQuery): Builder;
163 }
164 /**
165 * Possibles signatures for adding a where exists clause
166 */
167 interface WhereExists<Builder extends ChainableContract> {
168 (callback: QueryCallback<Builder> | ChainableContract | RawBuilderContract | RawQuery): Builder;
169 }
170 /**
171 * Possibles signatures for adding a where between clause
172 */
173 interface WhereBetween<Builder extends ChainableContract> {
174 /**
175 * Accept any string as a key for supporting prefix columns
176 */
177 (key: string | RawQuery, value: [StrictValues | ChainableContract, StrictValues | ChainableContract]): Builder;
178 }
179 /**
180 * Possible signatures for join query
181 */
182 interface Join<Builder extends ChainableContract> {
183 /**
184 * Defining the join table with primary and secondary columns
185 * to match
186 */
187 (table: string, primaryColumn: string, secondaryColumn: string): Builder;
188 /**
189 * Defining the join table with primary and secondary columns
190 * to match, where secondary column is output of a raw query
191 */
192 (table: string, primaryColumn: string, raw: RawQuery): Builder;
193 /**
194 * Defining the join table with primary and secondary columns
195 * to match with a custom operator
196 */
197 (table: string, primaryColumn: string, operator: string, secondaryColumn: string): Builder;
198 /**
199 * Join with a callback. The callback receives an array of join class from
200 * knex directly.
201 */
202 (table: string, callback: Knex.JoinCallback): Builder;
203 }
204 /**
205 * Possible signatures for a distinct clause
206 */
207 interface Distinct<Builder extends ChainableContract> {
208 (columns: string[]): Builder;
209 (...columns: string[]): Builder;
210 (column: '*'): Builder;
211 }
212 /**
213 * The signatures are same as the `distinct` method. For subqueries and
214 * raw queries, one must use `groupByRaw`.
215 */
216 interface GroupBy<Builder extends ChainableContract> extends Distinct<Builder> {
217 }
218 /**
219 * Possible signatures for aggregate functions. Aggregates will push to the
220 * result set. Unlike knex, we force defining aliases for each aggregate.
221 */
222 interface Aggregate<Builder extends ChainableContract> {
223 /**
224 * Accepting column with the alias for the count.
225 */
226 (column: OneOrMany<ValueWithSubQueries<string>>, alias?: string): Builder;
227 /**
228 * Accepting an object for multiple counts in a single query.
229 */
230 (columns: Dictionary<OneOrMany<ValueWithSubQueries<string>>, string>): Builder;
231 }
232 /**
233 * Possible signatures for orderBy method.
234 */
235 interface OrderBy<Builder extends ChainableContract> {
236 /**
237 * Order by a column and optional direction
238 */
239 (column: string | ChainableContract | RawBuilderContract | RawQuery, direction?: 'asc' | 'desc'): Builder;
240 /**
241 * Order by multiple columns in default direction
242 */
243 (columns: string[]): Builder;
244 /**
245 * Order by multiple columns and custom direction for each of them
246 */
247 (columns: {
248 column: string | ChainableContract | RawBuilderContract | RawQuery;
249 order?: 'asc' | 'desc';
250 }[]): Builder;
251 }
252 /**
253 * Possible signatures for a union clause
254 */
255 interface Union<Builder extends ChainableContract> {
256 (callback: OneOrMany<QueryCallback<Builder>>, wrap?: boolean): Builder;
257 (subquery: OneOrMany<ChainableContract | RawQuery>, wrap?: boolean): Builder;
258 }
259 /**
260 * Same signature as union
261 */
262 interface UnionAll<Builder extends ChainableContract> extends Union<Builder> {
263 }
264 /**
265 * Same signature as union
266 */
267 interface Intersect<Builder extends ChainableContract> extends Union<Builder> {
268 }
269 /**
270 * Possible signatures for having clause
271 */
272 interface Having<Builder extends ChainableContract> {
273 /**
274 * A subquery callback
275 */
276 (callback: QueryCallback<Builder> | RawBuilderContract | RawQuery): Builder;
277 /**
278 * Key operator and value. Value can be a subquery as well
279 */
280 (key: string | RawQuery, operator: string, value: StrictValues | ChainableContract | RawBuilderContract | RawQuery): Builder;
281 }
282 /**
283 * Possible signatures for `having in` clause.
284 */
285 interface HavingIn<Builder extends ChainableContract> {
286 /**
287 * Key and an array of literal values, raw queries or
288 * subqueries.
289 */
290 (key: string | RawQuery, value: (StrictValues | ChainableContract | RawBuilderContract | RawQuery)[]): Builder;
291 /**
292 * Key, along with a query callback
293 */
294 (key: string | RawQuery, callback: QueryCallback<Builder>): Builder;
295 }
296 /**
297 * Possible signatures for `having null` clause
298 */
299 interface HavingNull<Builder extends ChainableContract> extends WhereNull<Builder> {
300 }
301 /**
302 * Possible signatures for `having exists` clause
303 */
304 interface HavingExists<Builder extends ChainableContract> {
305 /**
306 * A query callback or a sub query
307 */
308 (callback: QueryCallback<Builder> | ChainableContract): Builder;
309 }
310 /**
311 * Possible signatures for having between
312 */
313 interface HavingBetween<Builder extends ChainableContract> extends WhereBetween<Builder> {
314 }
315 /**
316 * Possible signatures of `with` CTE
317 */
318 interface With<Builder extends ChainableContract> {
319 (alias: string, query: RawQuery | ChainableContract | QueryCallback<Builder>, columns?: string[]): Builder;
320 }
321 /**
322 * Possible signatures for defining table for a select query.
323 */
324 interface FromTable<Builder extends ChainableContract> {
325 (table: string | Dictionary<string, string> | QueryCallback<Builder> | ChainableContract): Builder;
326 }
327 /**
328 * Possible signatures for the `returning` method.
329 */
330 interface Returning<Builder> {
331 (column: OneOrMany<string>): Builder;
332 }
333 /**
334 * Possible signatures for performing an update
335 */
336 interface Update<Builder extends ChainableContract> {
337 /**
338 * Accepts an array of object of named key/value pair and returns an array
339 * of Generic return columns.
340 */
341 (values: Dictionary<any, string>, returning?: OneOrMany<string>): Builder;
342 /**
343 * Accepts a key-value pair to update.
344 */
345 (column: string, value: any, returning?: OneOrMany<string>): Builder;
346 }
347 /**
348 * Possible signatures for incrementing/decrementing
349 * values
350 */
351 interface Counter<Builder extends ChainableContract> {
352 (column: string, counter?: number): Builder;
353 (values: Dictionary<number, string>): Builder;
354 }
355 /**
356 * Possible signatures for an insert query
357 */
358 interface Insert<Builder extends InsertQueryBuilderContract> {
359 (values: Dictionary<any, string>): Builder;
360 }
361 /**
362 * Possible signatures for doing multiple inserts in a single query
363 */
364 interface MultiInsert<Builder extends InsertQueryBuilderContract> {
365 (values: Dictionary<any, string>[]): Builder;
366 }
367 /**
368 * The chainable contract has all the methods that can be chained
369 * to build a query. This interface will never have any
370 * methods to execute a query.
371 */
372 interface ChainableContract {
373 knexQuery: Knex.QueryBuilder;
374 columns: (string | Knex.QueryBuilder | Knex.RawQueryBuilder)[];
375 subQueryAlias?: string;
376 hasAggregates: boolean;
377 hasGroupBy: boolean;
378 hasUnion: boolean;
379 keysResolver?: (columnName: string) => string;
380 from: FromTable<this>;
381 select: DatabaseQueryBuilderSelect<this>;
382 wrapExisting(): this;
383 where: Where<this>;
384 orWhere: Where<this>;
385 andWhere: Where<this>;
386 whereNot: Where<this>;
387 orWhereNot: Where<this>;
388 andWhereNot: Where<this>;
389 whereColumn: WhereColumn<this>;
390 orWhereColumn: WhereColumn<this>;
391 andWhereColumn: WhereColumn<this>;
392 whereNotColumn: WhereColumn<this>;
393 orWhereNotColumn: WhereColumn<this>;
394 andWhereNotColumn: WhereColumn<this>;
395 whereIn: WhereIn<this>;
396 orWhereIn: WhereIn<this>;
397 andWhereIn: WhereIn<this>;
398 whereNotIn: WhereIn<this>;
399 orWhereNotIn: WhereIn<this>;
400 andWhereNotIn: WhereIn<this>;
401 whereNull: WhereNull<this>;
402 orWhereNull: WhereNull<this>;
403 andWhereNull: WhereNull<this>;
404 whereNotNull: WhereNull<this>;
405 orWhereNotNull: WhereNull<this>;
406 andWhereNotNull: WhereNull<this>;
407 whereExists: WhereExists<this>;
408 orWhereExists: WhereExists<this>;
409 andWhereExists: WhereExists<this>;
410 whereNotExists: WhereExists<this>;
411 orWhereNotExists: WhereExists<this>;
412 andWhereNotExists: WhereExists<this>;
413 whereBetween: WhereBetween<this>;
414 orWhereBetween: WhereBetween<this>;
415 andWhereBetween: WhereBetween<this>;
416 whereNotBetween: WhereBetween<this>;
417 orWhereNotBetween: WhereBetween<this>;
418 andWhereNotBetween: WhereBetween<this>;
419 whereRaw: RawQueryFn<this>;
420 orWhereRaw: RawQueryFn<this>;
421 andWhereRaw: RawQueryFn<this>;
422 whereLike: WhereLike<this>;
423 orWhereLike: WhereLike<this>;
424 andWhereLike: WhereLike<this>;
425 whereILike: WhereLike<this>;
426 orWhereILike: WhereLike<this>;
427 andWhereILike: WhereLike<this>;
428 whereJson: WhereJson<this>;
429 orWhereJson: WhereJson<this>;
430 andWhereJson: WhereJson<this>;
431 whereNotJson: WhereJson<this>;
432 orWhereNotJson: WhereJson<this>;
433 andWhereNotJson: WhereJson<this>;
434 whereJsonSuperset: WhereJson<this>;
435 orWhereJsonSuperset: WhereJson<this>;
436 andWhereJsonSuperset: WhereJson<this>;
437 whereNotJsonSuperset: WhereJson<this>;
438 orWhereNotJsonSuperset: WhereJson<this>;
439 andWhereNotJsonSuperset: WhereJson<this>;
440 whereJsonSubset: WhereJson<this>;
441 orWhereJsonSubset: WhereJson<this>;
442 andWhereJsonSubset: WhereJson<this>;
443 whereNotJsonSubset: WhereJson<this>;
444 orWhereNotJsonSubset: WhereJson<this>;
445 andWhereNotJsonSubset: WhereJson<this>;
446 whereJsonPath: WhereJsonPath<this>;
447 orWhereJsonPath: WhereJsonPath<this>;
448 andWhereJsonPath: WhereJsonPath<this>;
449 join: Join<this>;
450 innerJoin: Join<this>;
451 leftJoin: Join<this>;
452 leftOuterJoin: Join<this>;
453 rightJoin: Join<this>;
454 rightOuterJoin: Join<this>;
455 fullOuterJoin: Join<this>;
456 crossJoin: Join<this>;
457 joinRaw: RawQueryFn<this>;
458 having: Having<this>;
459 orHaving: Having<this>;
460 andHaving: Having<this>;
461 havingIn: HavingIn<this>;
462 orHavingIn: HavingIn<this>;
463 andHavingIn: HavingIn<this>;
464 havingNotIn: HavingIn<this>;
465 orHavingNotIn: HavingIn<this>;
466 andHavingNotIn: HavingIn<this>;
467 havingNull: HavingNull<this>;
468 orHavingNull: HavingNull<this>;
469 andHavingNull: HavingNull<this>;
470 havingNotNull: HavingNull<this>;
471 orHavingNotNull: HavingNull<this>;
472 andHavingNotNull: HavingNull<this>;
473 havingExists: HavingExists<this>;
474 orHavingExists: HavingExists<this>;
475 andHavingExists: HavingExists<this>;
476 havingNotExists: HavingExists<this>;
477 orHavingNotExists: HavingExists<this>;
478 andHavingNotExists: HavingExists<this>;
479 havingBetween: HavingBetween<this>;
480 orHavingBetween: HavingBetween<this>;
481 andHavingBetween: HavingBetween<this>;
482 havingNotBetween: HavingBetween<this>;
483 orHavingNotBetween: HavingBetween<this>;
484 andHavingNotBetween: HavingBetween<this>;
485 havingRaw: RawQueryFn<this>;
486 orHavingRaw: RawQueryFn<this>;
487 andHavingRaw: RawQueryFn<this>;
488 distinct: Distinct<this>;
489 distinctOn: Distinct<this>;
490 groupBy: GroupBy<this>;
491 groupByRaw: RawQueryFn<this>;
492 orderBy: OrderBy<this>;
493 orderByRaw: RawQueryFn<this>;
494 union: Union<this>;
495 unionAll: UnionAll<this>;
496 intersect: Intersect<this>;
497 with: With<this>;
498 withRecursive: With<this>;
499 withMaterialized: With<this>;
500 withNotMaterialized: With<this>;
501 withSchema(schema: string): this;
502 as(name: string): this;
503 offset(offset: number): this;
504 limit(limit: number): this;
505 clearSelect(): this;
506 clearWhere(): this;
507 clearOrder(): this;
508 clearHaving(): this;
509 clearLimit(): this;
510 clearOffset(): this;
511 forUpdate(...tableNames: string[]): this;
512 forShare(...tableNames: string[]): this;
513 skipLocked(): this;
514 noWait(): this;
515 /**
516 * Executes the callback when condition is truthy
517 */
518 if(condition: any, matchCallback: (query: this) => any, noMatchCallback?: (query: this) => any): this;
519 /**
520 * Executes the callback when condition is falsy
521 */
522 unless(condition: any, matchCallback: (query: this) => any, noMatchCallback?: (query: this) => any): this;
523 /**
524 * Write blocks to match from
525 */
526 match(...blocks: ([condition: any, callback: (query: this) => any] | ((query: this) => any))[]): this;
527 }
528 /**
529 * Shape of the raw query that can also be passed as a value to
530 * other queries
531 */
532 interface RawQueryBuilderContract<Result = any> extends ExcutableQueryBuilderContract<Result> {
533 knexQuery: Knex.Raw;
534 client: QueryClientContract;
535 wrap(before: string, after: string): this;
536 }
537 /**
538 * Reference builder
539 */
540 interface ReferenceBuilderContract {
541 withSchema(name: string): this;
542 as(name: string): this;
543 toKnex(client: Knex.Client): Knex.Ref<string, any>;
544 }
545 /**
546 * Static raw builder
547 */
548 interface RawBuilderContract {
549 wrap(before: string, after: string): this;
550 toKnex(client: Knex.Client): Knex.Raw;
551 }
552 /**
553 * The keys for the simple paginator meta
554 * data
555 */
556 type SimplePaginatorMetaKeys = {
557 total: string;
558 perPage: string;
559 currentPage: string;
560 lastPage: string;
561 firstPage: string;
562 firstPageUrl: string;
563 lastPageUrl: string;
564 nextPageUrl: string;
565 previousPageUrl: string;
566 };
567 /**
568 * Shape of the simple paginator that works with offset and limit
569 */
570 interface SimplePaginatorContract<Result> extends Array<Result> {
571 all(): Result[];
572 readonly firstPage: number;
573 readonly perPage: number;
574 readonly currentPage: number;
575 readonly lastPage: number;
576 readonly hasPages: boolean;
577 readonly hasMorePages: boolean;
578 readonly isEmpty: boolean;
579 readonly total: number;
580 readonly hasTotal: boolean;
581 namingStrategy: {
582 paginationMetaKeys(): SimplePaginatorMetaKeys;
583 };
584 baseUrl(url: string): this;
585 queryString(values: {
586 [key: string]: any;
587 }): this;
588 getUrl(page: number): string;
589 getMeta(): any;
590 getNextPageUrl(): string | null;
591 getPreviousPageUrl(): string | null;
592 getUrlsForRange(start: number, end: number): {
593 url: string;
594 page: number;
595 isActive: boolean;
596 }[];
597 toJSON(): {
598 meta: any;
599 data: Result[];
600 };
601 }
602 /**
603 * Database query builder exposes the API to construct SQL query using fluent
604 * chainable API
605 */
606 interface DatabaseQueryBuilderContract<Result = Dictionary<any, string>> extends ChainableContract, ExcutableQueryBuilderContract<Result[]> {
607 client: QueryClientContract;
608 returning: Returning<this>;
609 /**
610 * Clone current query
611 */
612 clone<ClonedResult = Result>(): DatabaseQueryBuilderContract<ClonedResult>;
613 /**
614 * Execute and get first result
615 */
616 first(): Promise<Result | null>;
617 /**
618 * Execute and get first result or fail
619 */
620 firstOrFail(): Promise<Result>;
621 /**
622 * Perform delete operation
623 */
624 del(returning?: OneOrMany<string>): this;
625 delete(returning?: OneOrMany<string>): this;
626 /**
627 * A shorthand to define limit and offset based upon the
628 * current page
629 */
630 forPage(page: number, perPage?: number): this;
631 /**
632 * Execute query with pagination
633 */
634 paginate(page: number, perPage?: number): Promise<SimplePaginatorContract<Result>>;
635 /**
636 * Mutations (update and increment can be one query aswell)
637 */
638 update: Update<this>;
639 increment: Counter<this>;
640 decrement: Counter<this>;
641 /**
642 * Aggregates
643 */
644 count: Aggregate<this>;
645 countDistinct: Aggregate<this>;
646 min: Aggregate<this>;
647 max: Aggregate<this>;
648 sum: Aggregate<this>;
649 sumDistinct: Aggregate<this>;
650 avg: Aggregate<this>;
651 avgDistinct: Aggregate<this>;
652 /**
653 * Executes the callback when dialect matches one of the mentioned
654 * dialects
655 */
656 ifDialect(dialect: DialectContract['name'] | DialectContract['name'][], matchCallback: (query: this) => any, noMatchCallback?: (query: this) => any): this;
657 /**
658 * Executes the callback when dialect matches doesn't all the mentioned
659 * dialects
660 */
661 unlessDialect(dialect: DialectContract['name'] | DialectContract['name'][], matchCallback: (query: this) => any, noMatchCallback?: (query: this) => any): this;
662 }
663 /**
664 * Insert query builder to perform database inserts.
665 */
666 interface InsertQueryBuilderContract<Result = any> extends ExcutableQueryBuilderContract<Result> {
667 knexQuery: Knex.QueryBuilder;
668 client: QueryClientContract;
669 /**
670 * Table for the insert query
671 */
672 table(table: string): this;
673 withSchema(schema: string): this;
674 /**
675 * Define returning columns
676 */
677 returning: Returning<this>;
678 /**
679 * Inserting a single record.
680 */
681 insert: Insert<this>;
682 /**
683 * Inserting multiple columns at once
684 */
685 multiInsert: MultiInsert<this>;
686 }
687 /**
688 * A executable query builder will always have these methods on it.
689 */
690 interface ExcutableQueryBuilderContract<Result> extends Promise<Result> {
691 debug(debug: boolean): this;
692 timeout(time: number, options?: {
693 cancel: boolean;
694 }): this;
695 useTransaction(trx: TransactionClientContract): this;
696 reporterData(data: any): this;
697 toQuery(): string;
698 exec(): Promise<Result>;
699 toSQL(): Knex.Sql;
700 }
701}
702
\No newline at end of file