From 2aa3612d56807d65cf2cff2253cef17cbfb3663a Mon Sep 17 00:00:00 2001 From: yakkomajuri Date: Thu, 1 Sep 2022 15:21:58 -0300 Subject: [PATCH] feat: update types --- index.d.ts | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/index.d.ts b/index.d.ts index 7ba52bd..6b43c5c 100644 --- a/index.d.ts +++ b/index.d.ts @@ -1,18 +1,39 @@ /// declare module 'clickhouse' { - import {Stream} from 'stream'; + import { Transform, Stream } from 'stream'; type callbackExec = (error: Error, rows?: Object[]) => void; + export interface DriverOptions { + debug: boolean, + database: string, + password: string, + basicAuth: { + username: string + password: string + }, + isUseGzip: boolean, + config: { + session_timeout: number, + output_format_json_quote_64bit_integers: number, + enable_http_compression: number + }, + format: 'json' | 'tsv' | 'csv', + raw: boolean, + isSessionPerQuery: boolean, + trimQuery: boolean, + usePost: boolean, + } + export class ClickHouse { - constructor(opts: Object); + constructor(opts: DriverOptions); query(query: String, reqParams?: object): QueryCursor; insert(query: String, data?: object): QueryCursor; sessionId: string; } - export class WriteStream extends Stream.Transform { + export class WriteStream extends Transform { writeRow(data: Array | string): Promise; exec(): Promise<{}>; }