-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.d.ts
125 lines (121 loc) · 2.85 KB
/
index.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
116
117
118
119
120
121
122
123
124
125
export default class Datarex {
public constructor(
options?: DatarexOptions.ConstructorOptions,
): DatarexOptions;
/**
* Adds two numbers in the database
*/
public add(key: String, value: String): Datarex;
/**
* Gets all the keys stored in the database table
*/
public all(): Datarex;
/**
* Backup the database to the place you desire
*/
public backUp(
options?: DatarexOptions.backUpOptions,
): Datarex;
/**
* Clears the cache
*/
public clearCache(): Datarex;
/**
* Closes the database to stop any changes
*/
public close(): Datarex;
/**
* Deletes a key from the database
*/
public delete(key: String): Datarex;
/**
* Deletes all the keys, thus erasing the database
*/
public deleteAll(): Datarex;
/**
* Divides a value in the database
*/
public divide(key: String, value: Number): Datarex;
/***
* Returns the key provided
*/
public get(key: String): Datarex;
/**
* Check if the key exists in the database
*/
public has(key: String): Datarex;
/**
* Multiplies a value in the database
*/
public multiply(key: String, value: Number): Datarex;
/**
* Pushes a Object/String into the key
*/
public push(key: String, value: String): Datarex;
/**
* Removes a Object/String/Array from the array from the key
*/
public removeArrVal(key: String, value: String): Datarex;
/**
* Removes Expiry from the key
*/
public removeExpiry(key: String): Datarex;
/**
* Removes a Object/String/Array from the Object from the key
*/
public removeObjVal(key: String): Datarex;
/**
* Sets a value in the database
*/
public set(key: String, value: String): Datarex;
/**
* Sets a expiry time for the key, so it gets deleted after that time
*/
public setExpiry(key: String, value: String): Datarex;
/**
* Sets many keys and values in the database
*/
public setMany(array: Array): Datarex;
/**
* Subtracts a value in the database
*/
public subtract(key: String, value: Number): Datarex;
private _async(code: String): Datarex;
private _ctine(): Datarex;
private _checkMissing(
key: String,
value: String,
): Datarex;
private _Server(
type: String,
key?: any,
value?: any,
): Datarex;
private _parseTime(timeString: String): Datarex;
}
declare namespace DatarexOptions {
export interface ConstructorOptions {
path?: String;
tableName?: String;
server?: {
listen?: "client" | "server"; //default client
type?: "client" | "server"; //default client
host?: "127.0.0.1"; //default 127.0.0.1
port?: 433; //default 433
password?: String;
};
Intervals?: {
expiryInterval?: Number; // defaults to 1000
clearCacheInterval?: Number; // defaults to 300000
};
settings?: {
inMemory?: Boolean; //defaults to true
clearCache?: Boolean; //defaults to true
loadKeys?: Boolean; //defaults to true
};
}
export interface backUpOptions {
path?: String;
name?: String;
}
}