mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-11-20 19:16:08 +00:00
fix(db): pass the chunk size and the abort options through the NUL-free connection
The wrapper took the chunk size of a stream as optional, which lint:strict refuses, and dropped the abort options Kysely hands executeQuery and streamQuery, so a cancelled query kept running.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import type { CompiledQuery, DatabaseConnection, Dialect, Driver } from 'kysely';
|
||||
import type { AbortableOperationOptions, CompiledQuery, DatabaseConnection, Dialect, Driver } from 'kysely';
|
||||
|
||||
/**
|
||||
* TREK stores no U+0000 (NUL) in text, on either engine.
|
||||
@@ -87,9 +87,10 @@ function nulFreeDriver(driver: Driver): Driver {
|
||||
let proxy = wrapped.get(connection);
|
||||
if (!proxy) {
|
||||
proxy = overriding(connection, {
|
||||
executeQuery: <R>(query: CompiledQuery) => connection.executeQuery<R>(nulFreeQuery(query)),
|
||||
streamQuery: <R>(query: CompiledQuery, chunkSize?: number) =>
|
||||
connection.streamQuery<R>(nulFreeQuery(query), chunkSize),
|
||||
executeQuery: <R>(query: CompiledQuery, options?: AbortableOperationOptions) =>
|
||||
connection.executeQuery<R>(nulFreeQuery(query), options),
|
||||
streamQuery: <R>(query: CompiledQuery, chunkSize: number, options?: AbortableOperationOptions) =>
|
||||
connection.streamQuery<R>(nulFreeQuery(query), chunkSize, options),
|
||||
});
|
||||
wrapped.set(connection, proxy);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user