-
Notifications
You must be signed in to change notification settings - Fork 0
/
model.ts
50 lines (46 loc) · 1.18 KB
/
model.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
export interface BracesDBOption {
/**
* Save type.
*
* If `memory` is in-memory.
*/
type: "memory";
}
export interface FileDBOption {
/**
* Folder path.
* It is generated in the project root by default.
*
* ex. db/store/
*/
folder?: string;
/**
* File Name.
* Saved `{filename}.db` .
* The default name is `main` .
*/
filename?: string;
}
export interface DatabaseFormat {
/**
* Add an Object to the DB
* @param data Datastore targeted for add
* @param object Object to be added to the DB
* @param keyword Use the specified key to prevent duplication
*/
add<T>(data: T[], object: T, keyword: keyof T): T[];
/**
* Remove matching objects from DB
* @param data Datastore targeted for delete
* @param key The key of the Object you want to search
* @param keyword Wording of search conditions
*/
delete<T>(data: T[], key: keyof T, keyword: T[keyof T]): T[];
/**
* Finding the DB
* @param data Datastore targeted for find
* @param key The key of the Object you want to search
* @param keyword Wording of search conditions
*/
find<T>(data: T[], key?: keyof T, keyword?: T[keyof T] | RegExp): T[];
}