-
-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Upgraded database system and bumped version
- Loading branch information
Showing
13 changed files
with
272 additions
and
209 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,66 +1,20 @@ | ||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
export interface Database<T = { [key: string]: any }> { | ||
/** | ||
* Save a value or update a value in the Database under a key | ||
* @param key The key you want to save the value as | ||
* @param value The value you want to save | ||
* @example Database.set('Test Key', 'Test Value'); | ||
*/ | ||
set<S extends keyof T>(key: S, value: T[S]): void; | ||
/** Database's data. */ | ||
data: T; | ||
|
||
/** | ||
* Get the value of the key | ||
* @param key | ||
* @returns value | ||
* @example Database.get('Test Key'); | ||
*/ | ||
get<S extends keyof T>(key: S): T[S]; | ||
/** Returns whether the database is a valid object that can have functions called and data read from. */ | ||
isValid(): boolean; | ||
|
||
/** | ||
* Check if the key exists in the table | ||
* @param key | ||
* @returns Whether the key exists | ||
* @example Database.has('Test Key'); | ||
*/ | ||
has(key: keyof T): boolean; | ||
/** Returns whether the database has loaded its data from its provider. */ | ||
isLoaded(): boolean; | ||
|
||
/** | ||
* Delete the key from the table | ||
* @param key | ||
* @example Database.delete('Test Key'); | ||
*/ | ||
delete(key: keyof T): void; | ||
|
||
/** | ||
* Clear everything in the table | ||
* @example Database.clear() | ||
*/ | ||
/** Clears everything in the database. */ | ||
clear(): void; | ||
|
||
/** | ||
* Save all changes made in the database. | ||
* @example Database.save() | ||
*/ | ||
/** Saves all changes made in the database. */ | ||
save(): void; | ||
|
||
/** | ||
* Get all the keys in the database | ||
* @returns Array of keys | ||
* @example Database.keys(); | ||
*/ | ||
keys(): (keyof T)[]; | ||
|
||
/** | ||
* Get all the values in the database | ||
* @returns Array of values | ||
* @example Database.values(); | ||
*/ | ||
values(): T[keyof T][]; | ||
|
||
/** | ||
* Get all the keys and values in the database in pairs | ||
* @returns Array of key/value pairs | ||
* @example Database.entries(); | ||
*/ | ||
entries<S extends keyof T>(): [S, T[S]][]; | ||
/** Deletes the database from the provider it was loaded from. */ | ||
delete(): void; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.