-
Notifications
You must be signed in to change notification settings - Fork 0
/
interfaces.ts
96 lines (95 loc) · 1.92 KB
/
interfaces.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
import {
deleteItemFunction,
getDataFunction,
getFieldsFunction,
getSchemeFunction,
getSchemesFunction,
getTableFunction,
getTablesFunction,
insertItemFunction,
migrateFunction,
seedFunction,
updateItemFunction,
} from './types';
// DB
export interface DBOptions {
dbPath: string;
}
export interface DBInterface {
path: string;
schemes: SchemeInterface[];
getSchemes: getSchemesFunction;
getScheme: getSchemeFunction;
}
// Scheme
export interface SchemeOptions {
schemeName: string;
db: DBInterface;
}
export interface SchemeInterface {
name: string;
path: string;
tables: TableInterface[];
getTables: getTablesFunction;
getTable: getTableFunction;
}
// Table
export interface TableOptions {
tableName: string;
scheme: SchemeInterface;
}
export interface TableInterface {
name: string;
tableFilePath: string;
getFields: getFieldsFunction;
getData: getDataFunction;
insertItem: insertItemFunction;
updateItem: updateItemFunction;
deleteItem: deleteItemFunction;
}
export interface TableDataItem {
[key: string]: number | string | boolean | null;
}
export interface TableFieldData {
name: string;
type: string;
primary_key: boolean;
nullable: boolean;
}
export interface TableFileData {
name: string;
fields: TableFieldData[];
data: TableDataItem[];
}
// Migrate
export interface MigrateOptions {
dbPath: string;
name: string;
schemes: MigrateSchemeData[];
}
export interface MigrateInterface {
options: MigrateOptions;
migrate: migrateFunction;
}
export interface MigrateTableData {
name: string;
fields: TableFieldData[];
}
export interface MigrateSchemeData {
name: string;
tables: MigrateTableData[];
}
// Seeder
export interface SeederOptions {
dbPath: string;
name: string;
data: SeederData[];
}
export interface SeederInterface {
options: SeederOptions;
seed: seedFunction;
}
export interface SeederData {
path: string;
items: TableDataItem[];
}