-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathutils.ts
More file actions
38 lines (33 loc) · 834 Bytes
/
utils.ts
File metadata and controls
38 lines (33 loc) · 834 Bytes
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
export class SqlContainer {
public readonly chains: ReadonlyArray<string>
public readonly expressions: any[]
public readonly count: number
constructor(
chains: ReadonlyArray<string>,
expressions: any[],
count: number
) {
this.chains = chains
this.expressions = expressions
this.count = count
}
}
export type TemplateLiteralFunc<T> = (
chains: ReadonlyArray<string>,
...expressions: any[]
) => T
export interface IPGQueryConfig {
_sql?: SqlContainer
text: string
values: any[]
}
export type Sql = TemplateLiteralFunc<IPGQueryConfig> & {
raw: (rawData: string) => IPGQueryConfig
}
export interface IPGQueryResult {
rowCount: number
rows: any[]
}
export interface IPGQueryable<T extends IPGQueryResult = IPGQueryResult> {
readonly query: (query: IPGQueryConfig) => Promise<T>
}