Skip to main content
Module

x/kysely_deno_postgres_dialect/mod.ts>kysely.QueryExecutor

Kysely dialect for PostgreSQL using the deno-postgres client.
Latest
interface kysely.QueryExecutor
implements ConnectionProvider
Re-export
import { type kysely } from "https://deno.land/x/kysely_deno_postgres_dialect@v0.27.1/mod.ts";
const { QueryExecutor } = kysely;

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.

Methods

getter
adapter(): DialectAdapter

Returns the adapter for the current dialect.

getter
plugins(): ReadonlyArray<KyselyPlugin>

Returns all installed plugins.

transformQuery<T extends RootOperationNode>(node: T, queryId: QueryId): T

Given the query the user has built (expressed as an operation node tree) this method runs it through all plugins' transformQuery methods and returns the result.

compileQuery<R = unknown>(node: RootOperationNode, queryId: QueryId): CompiledQuery<R>

Compiles the transformed query into SQL. You usually want to pass the output of transformQuery into this method but you can compile any query using this method.

executeQuery<R>(compiledQuery: CompiledQuery<R>, queryId: QueryId): Promise<QueryResult<R>>

Executes a compiled query and runs the result through all plugins' transformResult method.

stream<R>(
compiledQuery: CompiledQuery<R>,
chunkSize: number,
queryId: QueryId,
): AsyncIterableIterator<QueryResult<R>>

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

withConnectionProvider(connectionProvider: ConnectionProvider): QueryExecutor

Returns a copy of this executor with a new connection provider.

withPlugin(plugin: KyselyPlugin): QueryExecutor

Returns a copy of this executor with a plugin added as the last plugin.

withPlugins(plugin: ReadonlyArray<KyselyPlugin>): QueryExecutor

Returns a copy of this executor with a list of plugins added as the last plugins.

withPluginAtFront(plugin: KyselyPlugin): QueryExecutor

Returns a copy of this executor with a plugin added as the first plugin.

withoutPlugins(): QueryExecutor

Returns a copy of this executor without any plugins.