fix(duckdb): try fix typecheck (#39)
This commit is contained in:
@@ -123,6 +123,9 @@ export function drizzle<
|
||||
if (typeof connection === 'string')
|
||||
return constructByDSN(connection, drizzleConfig) as any
|
||||
|
||||
if (typeof connection === 'undefined')
|
||||
throw new Error('connection option is required')
|
||||
|
||||
return construct(connect({
|
||||
bundles: connection.bundles,
|
||||
logger: connection.logger,
|
||||
|
||||
@@ -43,7 +43,8 @@ export function parseDSN(dsn: string): StructuredDSN {
|
||||
structured.bundles = 'import-url'
|
||||
}
|
||||
|
||||
if (isLiterallyTrue(parsed.searchParams.get('logger'))) {
|
||||
const paramLogger = parsed.searchParams.get('logger')
|
||||
if (paramLogger && isLiterallyTrue(paramLogger)) {
|
||||
structured.logger = true
|
||||
}
|
||||
|
||||
@@ -57,9 +58,9 @@ export function parseDSN(dsn: string): StructuredDSN {
|
||||
structured.storage = {
|
||||
type: DBStorageType.ORIGIN_PRIVATE_FS,
|
||||
path: parsed.pathname.startsWith('/') ? parsed.pathname.slice(1) : parsed.pathname,
|
||||
...isLiterallyTrue(paramWrite) && {
|
||||
...(paramWrite && isLiterallyTrue(paramWrite) && {
|
||||
accessMode: DuckDBAccessMode.READ_WRITE,
|
||||
},
|
||||
}),
|
||||
}
|
||||
break
|
||||
}
|
||||
|
||||
@@ -73,8 +73,8 @@ export class DuckDBWasmSession<
|
||||
prepareQuery<T extends PreparedQueryConfig = PreparedQueryConfig>(
|
||||
query: Query,
|
||||
fields: SelectedFieldsOrdered | undefined,
|
||||
name: string | undefined,
|
||||
isResponseInArrayMode: boolean,
|
||||
_name: string | undefined,
|
||||
_isResponseInArrayMode: boolean,
|
||||
customResultMapper?: (rows: unknown[][]) => T['execute'],
|
||||
): PgPreparedQuery<T> {
|
||||
return new DuckDBWASMPreparedQuery(
|
||||
|
||||
@@ -25,7 +25,7 @@ export interface DuckDBWasmClient {
|
||||
db: AsyncDuckDB
|
||||
conn: AsyncDuckDBConnection
|
||||
close: () => Promise<void>
|
||||
query: (string, params?: unknown[]) => Promise<Record<string, unknown>[]>
|
||||
query: (query: string, params?: unknown[]) => Promise<Record<string, unknown>[]>
|
||||
}
|
||||
|
||||
export async function connect(options: ConnectOptions): Promise<DuckDBWasmClient> {
|
||||
|
||||
@@ -401,7 +401,7 @@ function parseInterval(arr: Int32Array) {
|
||||
const years = arr[0]
|
||||
const months = arr[1]
|
||||
|
||||
const result = []
|
||||
const result: string[] = []
|
||||
if (years !== 0) {
|
||||
result.push(`${years} year${years > 1 ? 's' : ''}`)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user