forked from DefinitelyTyped/DefinitelyTyped
-
Notifications
You must be signed in to change notification settings - Fork 0
/
mariasql.d.ts
115 lines (99 loc) · 3.23 KB
/
mariasql.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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
// Type definitions for mariasql v0.1.22
// Project: https://github.com/mscdex/node-mariasql
// Definitions by: MichaelBennett <https://github.com/bennett000/>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
declare module mariasql {
export interface MariaCallBackError {
(error:Error):void
}
export interface MariaCallBackResult {
(result:MariaResult):void
}
export interface MariaCallBackRow {
(result:Array<any>):void
}
export interface MariaCallBackBoolean {
(result:boolean):void
}
export interface MariaCallBackObject {
(result:Object):void
}
export interface MariaCallBackInfo {
(result:MariaInfo):void
}
export interface MariaCallBackVoid {
():void
}
export interface Dictionary {
[index: string]: any;
}
export interface MariaInfo {
affectedRows: number;
insertId: number;
numRows: number
}
export interface MariaPreparedQuery {
(values:Dictionary):string;
(values:Array<any>):string;
}
export interface ClientConfig {
host: string;
user: string;
password: string;
db?: string;
port?: number;
unixSocket?: string;
keepQueries?: boolean;
multiStatements?: boolean;
connTimeout?: number;
pingInterval?: number;
secureAuth?: boolean;
compress?: boolean;
ssl?:any;
local_infile?: boolean;
read_default_group?: string;
charset?: string;
}
export interface MariaResult {
on(signal:'end', cb:MariaCallBackInfo):MariaResult;
on(signal:'error', cb:MariaCallBackError):MariaResult;
on(signal:'row', cb:MariaCallBackRow):MariaResult;
on(signal:'abort', cb:MariaCallBackVoid):MariaResult;
on(signal:string, cb:MariaCallBackVoid):MariaResult;
abort():void;
}
export interface MariaQuery {
on(signal:'result', cb:MariaCallBackResult):MariaQuery;
on(signal:'end', cb:MariaCallBackVoid):MariaQuery;
on(signal:'abort', cb:MariaCallBackVoid):MariaQuery;
on(signal:'error', cb:MariaCallBackError):MariaQuery;
on(signal:string, cb:MariaCallBackVoid):MariaQuery;
abort():void;
}
export interface MariaClient {
connect(config:ClientConfig):void;
end():void;
destroy():void;
escape(query:string):string;
query(q:string, placeHolders?:Dictionary, useArray?:boolean):MariaQuery;
query(q:string, placeHolders?:Array<any>, useArray?:boolean):MariaQuery;
query(q:string, useArray?:boolean):MariaQuery;
prepare(query:string): MariaPreparedQuery;
isMariaDB():boolean;
on(signal:'error', cb:MariaCallBackError): MariaClient;
on(signal:'close', cb:MariaCallBackObject): MariaClient;
on(signal:'connect', cb:MariaCallBackVoid): MariaClient;
on(signal:string, cb:MariaCallBackVoid): MariaClient;
connected: boolean;
threadId: string;
}
export interface Client {
new ():MariaClient;
():MariaClient;
prototype: MariaClient;
}
}
declare module "mariasql" {
var Client:mariasql.Client;
export = Client;
}