kysely
    Preparing search index...

    Interface QueryExecutor

    This interface abstracts away the details of how to compile a query into SQL and execute it. Instead of passing around all those details, SelectQueryBuilder and other classes that execute queries can just pass around and instance of QueryExecutor.

    interface QueryExecutor {
        get adapter(): DialectAdapter;
        get plugins(): readonly KyselyPlugin[];
        compileQuery<R = unknown>(
            node: RootOperationNode,
            queryId: QueryId,
        ): CompiledQuery<R>;
        executeQuery<R>(
            compiledQuery: CompiledQuery<R>,
            queryId: QueryId,
        ): Promise<QueryResult<R>>;
        provideConnection<T>(
            consumer: (connection: DatabaseConnection) => Promise<T>,
        ): Promise<T>;
        stream<R>(
            compiledQuery: CompiledQuery<R>,
            chunkSize: number,
            queryId: QueryId,
        ): AsyncIterableIterator<QueryResult<R>>;
        transformQuery<T extends RootOperationNode>(node: T, queryId: QueryId): T;
        withConnectionProvider(
            connectionProvider: ConnectionProvider,
        ): QueryExecutor;
        withoutPlugins(): QueryExecutor;
        withPlugin(plugin: KyselyPlugin): QueryExecutor;
        withPluginAtFront(plugin: KyselyPlugin): QueryExecutor;
        withPlugins(plugin: readonly KyselyPlugin[]): QueryExecutor;
    }

    Hierarchy (View Summary)

    Index

    Accessors

    Methods

    • Executes a compiled query and runs the result through all plugins' transformResult method. Results are streamead instead of loaded at once.

      Type Parameters

      • R

      Parameters

      • compiledQuery: CompiledQuery<R>
      • chunkSize: number

        How many rows should be pulled from the database at once. Supported only by the postgres driver.

      • queryId: QueryId

      Returns AsyncIterableIterator<QueryResult<R>>