MCPcopy
hub / github.com/kysely-org/kysely / ConnectionBuilder

Class ConnectionBuilder

src/kysely.ts:834–858  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

832}
833
834export class ConnectionBuilder<DB> {
835 readonly #props: ConnectionBuilderProps
836
837 constructor(props: ConnectionBuilderProps) {
838 this.#props = freeze(props)
839 }
840
841 async execute<T>(
842 callback: (db: Kysely<DB>) => Promise<T>,
843 options?: AbortableOperationOptions,
844 ): Promise<T> {
845 return this.#props.executor.provideConnection(
846 async (connection) => {
847 const executor = this.#props.executor.withConnectionProvider(
848 new SingleConnectionProvider(connection),
849 )
850
851 const db = new Kysely<DB>({ ...this.#props, executor })
852
853 return await callback(db)
854 },
855 freeze({ signal: options?.signal }),
856 )
857 }
858}
859
860interface ConnectionBuilderProps extends KyselyProps {}
861

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…