Skip to content

Commit 3d8934b

Browse files
committed
Fix typescript
1 parent 3890091 commit 3d8934b

File tree

1 file changed

+39
-17
lines changed

1 file changed

+39
-17
lines changed

index.d.ts

+39-17
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,44 @@
1-
declare interface ChdbModule {
2-
Execute(query: string, format: string): string;
3-
Session(query: string, format: string, path: string): string;
4-
}
5-
6-
declare const chdb: ChdbModule;
1+
/**
2+
* Executes a query using the chdb addon.
3+
*
4+
* @param query The query string to execute.
5+
* @param format The format for the query result, default is "CSV".
6+
* @returns The query result as a string.
7+
*/
8+
export function query(query: string, format?: string): string;
79

8-
declare interface DB {
9-
format: string;
10+
/**
11+
* Session class for managing queries and temporary paths.
12+
*/
13+
export class Session {
14+
/**
15+
* The path used for the session. This could be a temporary path or a provided path.
16+
*/
1017
path: string;
11-
query(query: string, format?: string): string;
12-
session(query: string, format?: string, path?: string): string;
13-
}
1418

15-
declare interface DBFactory {
16-
(format?: string, path?: string): DB;
17-
new (format?: string, path?: string): DB;
18-
}
19+
/**
20+
* Indicates whether the path is a temporary directory or not.
21+
*/
22+
isTemp: boolean;
23+
24+
/**
25+
* Creates a new session. If no path is provided, a temporary directory is created.
26+
*
27+
* @param path Optional path for the session. If not provided, a temporary directory is used.
28+
*/
29+
constructor(path?: string);
1930

20-
declare const db: DBFactory;
31+
/**
32+
* Executes a session-bound query.
33+
*
34+
* @param query The query string to execute.
35+
* @param format The format for the query result, default is "CSV".
36+
* @returns The query result as a string.
37+
*/
38+
query(query: string, format?: string): string;
2139

22-
export { chdb, db };
40+
/**
41+
* Cleans up the session, deleting the temporary directory if one was created.
42+
*/
43+
cleanup(): void;
44+
}

0 commit comments

Comments
 (0)