@meanii/tinydb
Version:
tinydb is something, which you can use for as local non-sql database
68 lines • 2.21 kB
TypeScript
import { TinyDBModelType } from "./tinydb.type";
/**
* @discription TinyDb instance helps to manage a local json databases, which as many instances
* @example:
* const tinyDb = new Tinydb(`meanii-tinydb`)
* await tinydb.write([{isUser: true}])
*
* @author: anilchauhanxda@gmail.com - <https://github.com/meanii>
*/
export declare class Tinydb {
protected location: string;
/**
* init point TinyDb
* @param database - database name, which you want to create, it is going to be enforced the system to create the file
* weather if its already created or not
*/
private readonly database;
private readonly dbPath;
private readonly ACTIONS;
constructor(database: string);
/**
* this function helps to init the tinyDb to init the all processes, which is required to start before using it
* @returns {Promise<void>}
*/
private init;
/**
* this function helps to get all data from the database
* @returns {Promise<Array>}
*/
get(): Promise<TinyDBModelType[]>;
/**
* this function helps to find an object and return it
* @param query
* @returns {Promise<null|*>}
*/
findOne(query: TinyDBModelType): Promise<null | TinyDBModelType>;
/**
* this function helps to delete an object and return it
* @param query
* @returns {Promise<null|*>}
*/
deleteMany<T extends TinyDBModelType>(query: T): Promise<TinyDBModelType[]>;
/**
* this function helps to append data, to the db
* @param data TinydbType
* @returns {Promise<void>}
*/
insertOne<T extends TinyDBModelType>(data: T): Promise<T>;
/**
* this function helps to upsert the object
* @param query
* @param object
* @returns {Promise<void>}
*/
findOneAndUpdate(query: TinyDBModelType, object: TinyDBModelType): Promise<TinyDBModelType>;
/**
*this functions help to rewrite all data
* @param object
* @returns {Promise<void>}
*/
private write;
/**
* this functions delete everything, which they have stored
* @returns {Promise<void>}
*/
purgeAll(): Promise<void>;
}
//# sourceMappingURL=tinydb.d.ts.map