forked from DefinitelyTyped/DefinitelyTyped
-
Notifications
You must be signed in to change notification settings - Fork 0
/
mariasql.d.ts
102 lines (88 loc) · 3.06 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
// 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 MariaCallBackVoid {
():void
}
export interface Dictionary {
[index: string]: any;
}
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:string, cb:MariaCallBackObject):MariaResult; // signal 'end'
on(signal:string, cb:MariaCallBackError):MariaResult; // signal 'error'
on(signal:string, cb:MariaCallBackRow):MariaResult; // signal 'row'
on(signal:string, cb:MariaCallBackVoid):MariaResult; // signal 'abort'
abort():void;
}
export interface MariaQuery {
on(signal:string, cb:MariaCallBackResult):MariaQuery; // signal 'result'
on(signal:string, cb:MariaCallBackVoid):MariaQuery; // signal 'end'
on(signal:string, cb:MariaCallBackVoid):MariaQuery; // signal 'abort'
on(signal:string, cb:MariaCallBackError):MariaQuery; // signal 'error'
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:string, cb:MariaCallBackError): MariaClient; // signal 'error'
on(signal:string, cb:MariaCallBackObject): MariaClient; // signal 'close'
on(signal:string, cb:MariaCallBackVoid): MariaClient; // signal 'connect'
connected: boolean;
threadId: string;
}
export interface Client {
new ():MariaClient;
():MariaClient;
prototype: MariaClient;
}
}
declare module "mariasql" {
var Client:mariasql.Client;
export = Client;
}