UNPKG

1.44 kBTypeScriptView Raw
1import { Knex } from 'knex';
2import { QueryClientContract, TransactionClientContract } from '@ioc:Adonis/Lucid/Database';
3/**
4 * Query runner exposes the API for executing knex query builder by using the
5 * read/write replicas supported only by Lucid.
6 *
7 * Also it will emit the query data and profile the queries as well.
8 */
9export declare class QueryRunner {
10 private client;
11 private debug;
12 private logData;
13 private reporter;
14 constructor(client: QueryClientContract | TransactionClientContract, debug: boolean, logData: any);
15 /**
16 * Is query dialect using sqlite database or not
17 */
18 private isUsingSqlite;
19 /**
20 * Find if query has a transaction attached to it, by using
21 * `useTransaction` method
22 */
23 private isInTransaction;
24 /**
25 * Find if query is a write query or not.
26 */
27 private isWriteQuery;
28 /**
29 * Returns read or write client by inspecting the query
30 */
31 private getQueryClient;
32 /**
33 * Executes the query by handling exceptions and returns it back
34 * gracefully.
35 */
36 private executeQuery;
37 /**
38 * Executes the knex builder directly
39 */
40 private executeDirectly;
41 /**
42 * Executes query by using a proper read or write connection.
43 */
44 private executeUsingManagedConnection;
45 /**
46 * Run query by managing its life-cycle
47 */
48 run(query: Knex.QueryBuilder | Knex.Raw): Promise<any>;
49}