-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
739bdfe
commit 2274314
Showing
5 changed files
with
450 additions
and
3 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
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 |
---|---|---|
@@ -0,0 +1,52 @@ | ||
interface Data { | ||
[key: string]: any[]; | ||
} | ||
interface IncDecObject { | ||
[key: string]: number; | ||
} | ||
interface Object { | ||
[key: string]: any; | ||
$inc?: IncDecObject; | ||
$dec?: IncDecObject; | ||
$pop?: { | ||
[key: string]: 0 | -1; | ||
}; | ||
$push?: { | ||
[key: string]: any; | ||
}; | ||
} | ||
interface UpdateManyOptions { | ||
updateAll: boolean; | ||
} | ||
interface DeleteManyOptions { | ||
deleteAll: boolean; | ||
} | ||
interface ConnectOptions { | ||
writeSync?: boolean; | ||
} | ||
export declare class JSONDB { | ||
readonly data: Data; | ||
readonly dataName: string; | ||
readonly dataArr: Object[]; | ||
validate: any; | ||
connected: boolean; | ||
updateKeywords: string[]; | ||
dbOptions: ConnectOptions; | ||
constructor(dataName: string); | ||
get allData(): Promise<Object[]>; | ||
connect(schema: Object, options: ConnectOptions): Promise<unknown>; | ||
create(data: Object): Promise<unknown>; | ||
findOne(filter: Object): Promise<Object | null>; | ||
findMany(filter: Object): Promise<Object[]>; | ||
findOneAndUpdate(filter: Object, newData: Object): Promise<unknown>; | ||
updateMany(filter: Object, newData: Object, options?: UpdateManyOptions): Promise<unknown>; | ||
findOneAndDelete(filter: Object): Promise<unknown>; | ||
deleteMany(filter: Object, options?: DeleteManyOptions): Promise<unknown>; | ||
private filter; | ||
private updateJSONFile; | ||
private update; | ||
private validateSchema; | ||
private updateNumberValues; | ||
private updateArrayValues; | ||
} | ||
export {}; |
Oops, something went wrong.