forked from ghdna/athena-express
-
Notifications
You must be signed in to change notification settings - Fork 7
/
index.d.ts
67 lines (61 loc) 路 2.12 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
declare module 'athena-express-plus' {
import { S3Client } from '@aws-sdk/client-s3';
import { AthenaClient } from '@aws-sdk/client-athena';
interface ConnectionConfigInterface {
s3: S3Client;
athena: AthenaClient;
s3Bucket: string;
getStats: boolean;
db: string,
workgroup: string,
formatJson: boolean,
retry: number,
ignoreEmpty: boolean,
encryption: Record<string, string>,
skipResults: boolean,
waitForResults: boolean,
catalog: string,
pagination: string,
flatKeys: boolean,
resultReuse: boolean,
resultReuseMaxAge: number;
}
interface QueryResultsInterface<T> {
Items: T[];
DataScannedInMB: number;
QueryCostInUSD: number;
EngineExecutionTimeInMillis: number;
S3Location: string;
QueryExecutionId: string;
NextToken: string;
Count: number;
DataScannedInBytes: number;
TotalExecutionTimeInMillis: number;
QueryQueueTimeInMillis: number;
QueryPlanningTimeInMillis: number;
ServiceProcessingTimeInMillis: number;
}
interface QueryObjectInterface {
sql: string;
db?: string;
pagination?: number;
NextToken?: string;
QueryExecutionId?: string;
catalog?: string;
values?: string[]
}
interface QueryOptionsInterface {
resultReuse?: boolean,
resultReuseMaxAge?: number;
}
type DirectQueryString = string;
type QueryExecutionId = string;
type OptionalQueryResultsInterface<T> = Partial<QueryResultsInterface<T>> & Pick<QueryResultsInterface<T>, 'QueryExecutionId'>;
type QueryResult<T> = OptionalQueryResultsInterface<T>;
type QueryFunc<T> = (query: QueryObjectInterface|DirectQueryString|QueryExecutionId, values?: string[], options?: QueryOptionsInterface) => Promise<QueryResult<T>>;
class AthenaExpress<T> {
public new: (config: Partial<ConnectionConfigInterface>) => any;
public query: QueryFunc<T>;
constructor(config: Partial<ConnectionConfigInterface>);
}
}