-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.d.ts
More file actions
43 lines (37 loc) · 1.3 KB
/
index.d.ts
File metadata and controls
43 lines (37 loc) · 1.3 KB
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
import type {
QueryArrayConfig,
QueryArrayResult,
QueryConfig,
QueryConfigValues,
QueryResult,
QueryResultRow,
Submittable,
} from "pg";
import type { Plugin } from "vite";
export default function postgres(opts?: {
/**
* Path to a folder where all declaration are kept relative to `rootFolder`, i.e. a file at path `src/sql/module.sql` will have its `.d.ts` file generated into `${typesFolder}/src/sql/module.sql.d.ts`. Make sure you include this one in your `tsconfig.json`.
*
* @default "node_modules/@types/vite-plugin-postgres-import/"
*/
typesFolder?: string;
/**
* Root folder relative to which path calculation will be happening. May be useful for some I guess.
*
* @default process.cwd()
*/
rootFolder?: string;
}): Plugin;
export interface QueryableObject {
query<T extends Submittable>(queryStream: T): T;
query<R extends any[] = any[], I = any[]>(
queryConfig: QueryArrayConfig<I>,
values?: QueryConfigValues<I>
): Promise<QueryArrayResult<R>>;
query<R extends QueryResultRow = any, I = any>(queryConfig: QueryConfig<I>): Promise<QueryResult<R>>;
query<R extends QueryResultRow = any, I = any[]>(
queryTextOrConfig: string | QueryConfig<I>,
values?: QueryConfigValues<I>
): Promise<QueryResult<R>>;
}
export type Queryable = QueryableObject | Promise<QueryableObject>;