-
-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathindex.d.ts
105 lines (87 loc) · 2.59 KB
/
index.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
import { LocalChDB } from ".";
/**
* Executes a query using the chdb addon.
*
* @param query The query string to execute.
* @param format The format for the query result, default is "CSV".
* @returns The query result as a string.
*/
export function query(query: string, format?: string): string;
export function queryBuffer(query: string, format?: string): Buffer;
export class LocalResultV2Wrapper {
/**
* Retrieves the buffer containing the result data.
* @returns A `Buffer` containing the query result.
*/
getBuffer(): Buffer;
/**
* Retrieves the length of the buffer.
* @returns The length of the buffer as a `number`.
*/
getLength(): number;
/**
* Retrieves the elapsed time for the query execution.
* @returns The elapsed time in seconds as a `number`.
*/
getElapsed(): number;
/**
* Retrieves the number of rows read during the query execution.
* @returns The number of rows read as a `number`.
*/
getRowsRead(): number;
/**
* Retrieves the number of bytes read during the query execution.
* @returns The number of bytes read as a `number`.
*/
getBytesRead(): number;
/**
* Retrieves the error message, if any.
* @returns The error message as a `string`, or `null` if no error occurred.
*/
getErrorMessage(): string | null;
}
export class LocalChDB {
conn: any;
/**
* The path used for the session. This could be a temporary path or a provided path.
*/
path: string;
/**
* Indicates whether the path is a temporary directory or not.
*/
isTemp: boolean;
constructor(path?: string);
query(query: string|Buffer, format?: string): LocalResultV2Wrapper;
}
/**
* Session class for managing queries and temporary paths.
*/
export class Session {
/**
* The path used for the session. This could be a temporary path or a provided path.
*/
path: string;
/**
* Indicates whether the path is a temporary directory or not.
*/
isTemp: boolean;
/**
* Creates a new session. If no path is provided, a temporary directory is created.
*
* @param path Optional path for the session. If not provided, a temporary directory is used.
*/
constructor(path?: string);
/**
* Executes a session-bound query.
*
* @param query The query string to execute.
* @param format The format for the query result, default is "CSV".
* @returns The query result as a string.
*/
query(query: string, format?: string): string;
queryBuffer(query: string, format?: string): Buffer;
/**
* Cleans up the session, deleting the temporary directory if one was created.
*/
cleanup(): void;
}