mysql2-core 0.2.3 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/build.js +40 -40
- package/lib/index.js +806 -283
- package/package.json +2 -1
- package/src/build.ts +153 -153
- package/src/index.ts +925 -462
- package/src/metadata.ts +51 -70
package/src/metadata.ts
CHANGED
|
@@ -1,82 +1,63 @@
|
|
|
1
1
|
export interface StringMap {
|
|
2
|
-
[key: string]: string
|
|
2
|
+
[key: string]: string
|
|
3
3
|
}
|
|
4
4
|
export interface Statement {
|
|
5
|
-
query: string
|
|
6
|
-
params?: any[]
|
|
5
|
+
query: string
|
|
6
|
+
params?: any[]
|
|
7
7
|
}
|
|
8
8
|
|
|
9
|
-
export interface
|
|
10
|
-
driver: string
|
|
11
|
-
param(i: number): string
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
query<T>(sql: string, args?: any[], m?: StringMap, bools?: Attribute[], ctx?: any): Promise<T[]
|
|
15
|
-
queryOne<T>(sql: string, args?: any[], m?: StringMap, bools?: Attribute[], ctx?: any): Promise<T|null
|
|
16
|
-
|
|
17
|
-
count(sql: string, args?: any[], ctx?: any): Promise<number
|
|
9
|
+
export interface Executor {
|
|
10
|
+
driver: string
|
|
11
|
+
param(i: number): string
|
|
12
|
+
execute(sql: string, args?: any[], ctx?: any): Promise<number>
|
|
13
|
+
executeBatch(statements: Statement[], firstSuccess?: boolean, ctx?: any): Promise<number>
|
|
14
|
+
query<T>(sql: string, args?: any[], m?: StringMap, bools?: Attribute[], ctx?: any): Promise<T[]>
|
|
15
|
+
queryOne<T>(sql: string, args?: any[], m?: StringMap, bools?: Attribute[], ctx?: any): Promise<T | null>
|
|
16
|
+
executeScalar<T>(sql: string, args?: any[], ctx?: any): Promise<T>
|
|
17
|
+
count(sql: string, args?: any[], ctx?: any): Promise<number>
|
|
18
18
|
}
|
|
19
|
-
export interface
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
exec(sql: string, args?: any[], ctx?: any): Promise<number>;
|
|
23
|
-
execBatch(statements: Statement[], firstSuccess?: boolean, ctx?: any): Promise<number>;
|
|
24
|
-
query<T>(sql: string, args?: any[], m?: StringMap, bools?: Attribute[], ctx?: any): Promise<T[]>;
|
|
25
|
-
queryOne<T>(sql: string, args?: any[], m?: StringMap, bools?: Attribute[], ctx?: any): Promise<T|null>;
|
|
26
|
-
execScalar<T>(sql: string, args?: any[], ctx?: any): Promise<T>;
|
|
27
|
-
count(sql: string, args?: any[], ctx?: any): Promise<number>;
|
|
19
|
+
export interface Transaction extends Executor {
|
|
20
|
+
commit(): Promise<void>
|
|
21
|
+
rollback(): Promise<void>
|
|
28
22
|
}
|
|
29
|
-
export
|
|
30
|
-
|
|
31
|
-
| 'object' | 'array' | 'binary'
|
|
32
|
-
| 'primitives' | 'booleans' | 'numbers' | 'integers' | 'strings' | 'dates' | 'datetimes' | 'times';
|
|
33
|
-
export type FormatType = 'currency' | 'percentage' | 'email' | 'url' | 'phone' | 'fax' | 'ipv4' | 'ipv6';
|
|
34
|
-
export type MatchType = 'equal' | 'prefix' | 'contain' | 'max' | 'min'; // contain: default for string, min: default for Date, number
|
|
35
|
-
|
|
36
|
-
export interface Model {
|
|
37
|
-
name?: string;
|
|
38
|
-
attributes: Attributes;
|
|
39
|
-
source?: string;
|
|
40
|
-
table?: string;
|
|
41
|
-
collection?: string;
|
|
42
|
-
model?: any;
|
|
43
|
-
schema?: any;
|
|
23
|
+
export interface DB extends Executor {
|
|
24
|
+
beginTransaction(): Promise<Transaction>
|
|
44
25
|
}
|
|
26
|
+
export type DataType =
|
|
27
|
+
| "ObjectId"
|
|
28
|
+
| "date"
|
|
29
|
+
| "datetime"
|
|
30
|
+
| "time"
|
|
31
|
+
| "boolean"
|
|
32
|
+
| "number"
|
|
33
|
+
| "integer"
|
|
34
|
+
| "string"
|
|
35
|
+
| "text"
|
|
36
|
+
| "object"
|
|
37
|
+
| "array"
|
|
38
|
+
| "binary"
|
|
39
|
+
| "primitives"
|
|
40
|
+
| "booleans"
|
|
41
|
+
| "numbers"
|
|
42
|
+
| "integers"
|
|
43
|
+
| "strings"
|
|
44
|
+
| "dates"
|
|
45
|
+
| "datetimes"
|
|
46
|
+
| "times"
|
|
47
|
+
|
|
45
48
|
export interface Attribute {
|
|
46
|
-
name?: string
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
q?: boolean;
|
|
58
|
-
noinsert?: boolean;
|
|
59
|
-
noupdate?: boolean;
|
|
60
|
-
nopatch?: boolean;
|
|
61
|
-
version?: boolean;
|
|
62
|
-
length?: number;
|
|
63
|
-
min?: number;
|
|
64
|
-
max?: number;
|
|
65
|
-
gt?: number;
|
|
66
|
-
lt?: number;
|
|
67
|
-
precision?: number;
|
|
68
|
-
scale?: number;
|
|
69
|
-
exp?: RegExp | string;
|
|
70
|
-
code?: string;
|
|
71
|
-
noformat?: boolean;
|
|
72
|
-
ignored?: boolean;
|
|
73
|
-
jsonField?: string;
|
|
74
|
-
link?: string;
|
|
75
|
-
typeof?: Attributes;
|
|
76
|
-
true?: string|number;
|
|
77
|
-
false?: string|number;
|
|
78
|
-
getString?: (v: any) => string;
|
|
49
|
+
name?: string
|
|
50
|
+
column?: string
|
|
51
|
+
type?: DataType
|
|
52
|
+
default?: string | number | Date | boolean
|
|
53
|
+
key?: boolean
|
|
54
|
+
noinsert?: boolean
|
|
55
|
+
noupdate?: boolean
|
|
56
|
+
version?: boolean
|
|
57
|
+
ignored?: boolean
|
|
58
|
+
true?: string | number
|
|
59
|
+
false?: string | number
|
|
79
60
|
}
|
|
80
61
|
export interface Attributes {
|
|
81
|
-
[key: string]: Attribute
|
|
62
|
+
[key: string]: Attribute
|
|
82
63
|
}
|