-
Notifications
You must be signed in to change notification settings - Fork 217
/
formatting.ts
48 lines (32 loc) · 1010 Bytes
/
formatting.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
import * as pgPromise from '../../typescript/pg-promise';
const value1 = pgPromise.as.array([]);
const value2 = pgPromise.as.array(() => []);
const pgp: pgPromise.IMain = pgPromise();
const value3 = pgp.as.array([]);
const value4 = pgp.as.array(() => []);
const value5 = pgp.as.format('hello', []);
const value6 = pgp.as.format(new pgPromise.QueryFile(''));
let alias = pgp.as.alias('a');
alias = pgp.as.alias(() => 'a');
class CTF {
toPostgres(a: any) {
}
rawType: boolean;
// CTF symbols support:
[pgp.as.ctf.toPostgres](): any {
return 123;
};
// Ops! TypeScript doesn't support it yet!
// See these issues:
// - https://github.com/Microsoft/TypeScript/issues/16432
// - https://github.com/Microsoft/TypeScript/pull/15473
//
// [pgp.as.ctf.rawType]: boolean;
}
const ctf = new CTF();
const testCTF = pgp.as.format(ctf, null, {def: 1});
const testFunc1 = pgp.as.func(() => {
});
const testFunc2 = pgp.as.func(a => {
return 123;
});