1
- import { FastifyPluginCallback } from " fastify" ;
1
+ import { FastifyPluginCallback } from ' fastify'
2
2
import {
3
3
Connection ,
4
4
ConnectionOptions ,
@@ -9,54 +9,54 @@ import {
9
9
ProcedureCallPacket ,
10
10
ResultSetHeader ,
11
11
RowDataPacket ,
12
- } from " mysql2" ;
12
+ } from ' mysql2'
13
13
import {
14
14
Connection as PromiseConnection ,
15
15
Pool as PromisePool ,
16
- } from " mysql2/promise" ;
16
+ } from ' mysql2/promise'
17
17
18
- type FastifyMysql = FastifyPluginCallback < fastifyMysql . FastifyMySQLOptions > ;
18
+ type FastifyMysql = FastifyPluginCallback < fastifyMysql . FastifyMySQLOptions >
19
19
20
20
declare namespace fastifyMysql {
21
21
22
- type MySQLPoolConnection = MySQLPool | MySQLConnection | MySQLPromisePool | MySQLPromiseConnection ;
23
- export function isMySQLPool ( obj : MySQLPoolConnection ) : obj is MySQLPool ;
24
- export function isMySQLPromisePool ( obj : MySQLPoolConnection ) : obj is MySQLPromisePool ;
25
- export function isMySQLConnection ( obj : MySQLPoolConnection ) : obj is MySQLConnection ;
26
- export function isMySQLPromiseConnection ( obj : MySQLPoolConnection ) : obj is MySQLPromiseConnection ;
22
+ type MySQLPoolConnection = MySQLPool | MySQLConnection | MySQLPromisePool | MySQLPromiseConnection
23
+ export function isMySQLPool ( obj : MySQLPoolConnection ) : obj is MySQLPool
24
+ export function isMySQLPromisePool ( obj : MySQLPoolConnection ) : obj is MySQLPromisePool
25
+ export function isMySQLConnection ( obj : MySQLPoolConnection ) : obj is MySQLConnection
26
+ export function isMySQLPromiseConnection ( obj : MySQLPoolConnection ) : obj is MySQLPromiseConnection
27
27
28
28
// upstream package missed type
29
- type escapeId = ( val : any , forbidQualified ?: boolean ) => string ;
29
+ type escapeId = ( val : any , forbidQualified ?: boolean ) => string
30
30
31
31
interface BaseClient {
32
32
format : typeof format ;
33
33
escape : typeof escape ;
34
34
escapeId : escapeId ;
35
35
}
36
36
37
- export type MySQLConnection = Pick < Connection , " query" | " execute" > & {
37
+ export type MySQLConnection = Pick < Connection , ' query' | ' execute' > & {
38
38
connection : Connection ;
39
- } & BaseClient ;
39
+ } & BaseClient
40
40
41
- export type MySQLPool = Pick < Pool , " query" | " execute" | " getConnection" > & {
41
+ export type MySQLPool = Pick < Pool , ' query' | ' execute' | ' getConnection' > & {
42
42
pool : Pool ;
43
- } & BaseClient ;
43
+ } & BaseClient
44
44
45
45
export type MySQLPromiseConnection = Pick <
46
46
PromiseConnection ,
47
- " query" | " execute"
47
+ ' query' | ' execute'
48
48
> & {
49
49
connection : PromiseConnection ;
50
- } & BaseClient ;
50
+ } & BaseClient
51
51
52
52
export type MySQLPromisePool = Pick <
53
53
PromisePool ,
54
- " query" | " execute" | " getConnection"
54
+ ' query' | ' execute' | ' getConnection'
55
55
> & {
56
56
pool : PromisePool ;
57
- } & BaseClient ;
57
+ } & BaseClient
58
58
59
- export type ConnectionType = " connection" | " pool" ;
59
+ export type ConnectionType = ' connection' | ' pool'
60
60
61
61
export interface FastifyMySQLOptions extends PoolOptions , ConnectionOptions {
62
62
type ?: ConnectionType ;
@@ -66,7 +66,7 @@ declare namespace fastifyMysql {
66
66
}
67
67
68
68
export type MySQLProcedureCallPacket <
69
- T = [ MySQLRowDataPacket [ ] , MySQLResultSetHeader ] | MySQLResultSetHeader ,
69
+ T = [ MySQLRowDataPacket [ ] , MySQLResultSetHeader ] | MySQLResultSetHeader
70
70
> = ProcedureCallPacket < T >
71
71
export type MySQLResultSetHeader = ResultSetHeader
72
72
export type MySQLRowDataPacket = RowDataPacket
@@ -80,5 +80,5 @@ declare namespace fastifyMysql {
80
80
}
81
81
}
82
82
83
- declare function fastifyMysql ( ...params : Parameters < FastifyMysql > ) : ReturnType < FastifyMysql >
83
+ declare function fastifyMysql ( ...params : Parameters < FastifyMysql > ) : ReturnType < FastifyMysql >
84
84
export = fastifyMysql
0 commit comments