-
-
Notifications
You must be signed in to change notification settings - Fork 609
/
of.ts
73 lines (57 loc) · 2.03 KB
/
of.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
68
69
70
71
72
73
import { mysql } from '../../../index.js';
import { access, uriAccess, sql, sqlPS, values } from '../../baseConnection.js';
const poolCluster = mysql.createPoolCluster();
poolCluster.add('cluster1', uriAccess);
poolCluster.add('cluster2', access);
/** execute */
{
const conn = poolCluster.of('cluster1');
/** Overload: execute(sql, () => {}}) */
conn.execute(sql, (err, result, fields) => {
console.log(err, result, fields);
});
/** Overload: execute(sql, values, () => {}}) */
conn.execute(sqlPS, values, (err, result, fields) => {
console.log(err, result, fields);
});
/** Overload: execute(QueryOptions, () => {}}) I */
conn.execute({ sql }, (err, result, fields) => {
console.log(err, result, fields);
});
/** Overload: execute(QueryOptions, () => {}}) II */
conn.execute({ sql: sqlPS, values }, (err, result, fields) => {
console.log(err, result, fields);
});
/** Overload: execute(QueryOptions, values, () => {}}) */
conn.execute({ sql: sqlPS }, values, (err, result, fields) => {
console.log(err, result, fields);
});
/** @ts-expect-error: PoolNamespace can't be a `PoolConnection` */
conn.release();
}
/** query */
{
const conn = poolCluster.of('cluster2');
/** Overload: query(sql, () => {}}) */
conn.query(sql, (err, result, fields) => {
console.log(err, result, fields);
});
/** Overload: query(sql, values, () => {}}) */
conn.query(sqlPS, values, (err, result, fields) => {
console.log(err, result, fields);
});
/** Overload: query(QueryOptions, () => {}}) I */
conn.query({ sql }, (err, result, fields) => {
console.log(err, result, fields);
});
/** Overload: query(QueryOptions, () => {}}) II */
conn.query({ sql: sqlPS, values }, (err, result, fields) => {
console.log(err, result, fields);
});
/** Overload: query(QueryOptions, values, () => {}}) */
conn.query({ sql: sqlPS }, values, (err, result, fields) => {
console.log(err, result, fields);
});
/** @ts-expect-error: PoolNamespace can't be a `PoolConnection` */
conn.release();
}