-
Notifications
You must be signed in to change notification settings - Fork 5.6k
Expand file tree
/
Copy pathsql-prop.d.ts
More file actions
48 lines (48 loc) · 1.42 KB
/
sql-prop.d.ts
File metadata and controls
48 lines (48 loc) · 1.42 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
44
45
46
47
48
import { JsonPrimitive } from "type-fest";
import { ExecuteQueryArgs } from "./sql";
export type ColumnSchema = {
columnDefault: JsonPrimitive;
dataType: string;
isNullable: boolean;
tableSchema?: string;
};
export type TableMetadata = {
rowCount?: number;
};
export type TableSchema = {
[columnName: string]: ColumnSchema;
};
export type TableInfo = {
metadata: TableMetadata;
schema: TableSchema;
};
export type DbInfo = {
[tableName: string]: TableInfo;
};
export type SqlProp = {
query: string;
params?: string[];
};
declare const _default: {
methods: {
/**
* A method that transforms the value of a prop of type `sql` so that it can
* be fed to the `executeQuery` method.
*
* @param sqlProp - The prop of type `sql`
* @returns The arguments to be passed to `executeQuery`
*/
executeQueryAdapter(sqlProp: SqlProp): ExecuteQueryArgs;
/**
* A helper method to get the schema of the database. Used by other features
* (like the `sql` prop) to enrich the code editor and provide the user with
* auto-complete and fields suggestion.
*
* @returns {DbInfo} The schema of the database, which is a
* JSON-serializable object.
* @throws {ConfigurationError} If the method is not implemented.
*/
getSchema(): DbInfo;
};
};
export default _default;