axiodb
Version:
A blazing-fast, lightweight, and scalable nodejs package based DBMS for modern application. Supports schemas, encryption, and advanced query capabilities.
37 lines (36 loc) • 1.72 kB
TypeScript
import Collection from "../Collection/collection.operation";
import { ErrorInterface, SuccessInterface } from "../../config/Interfaces/Helper/response.helper.interface";
/**
* Represents a database instance.
*/
export default class Database {
private name;
private readonly path;
private fileManager;
private folderManager;
private ResponseHelper;
constructor(name: string, path: string);
/**
* Creates a new collection inside the specified database.
* @param {string} collectionName - Name of the collection.
* @param {boolean} isSchemaNeeded - Whether the collection requires a schema.
* @param {object} schema - Schema of the collection.
* @param {boolean} crypto - Enable crypto for the collection.
* @param {string} key - Key for crypto.
* @returns {Promise<AxioDB>} - Returns the instance of AxioDB.
*/
createCollection(collectionName: string, isSchemaNeeded: boolean | undefined, schema: object | any, crypto?: boolean, key?: string | undefined): Promise<Collection>;
/**
* Deletes a collection from the database.
* @param {string} collectionName - Name of the collection to delete.
* @returns {Promise<void>} - Returns a promise.
* @throws {Error} - Throws an error if the collection does not exist.
*/
deleteCollection(collectionName: string): Promise<SuccessInterface | ErrorInterface | undefined>;
/**
* Lists all collections in the database.
* @returns {Promise<FinalCollectionsInfo>} - Returns a promise with the list of collections data.
* @throws {Error} - Throws an error if the database does not exist.
*/
getCollectionInfo(): Promise<SuccessInterface | undefined>;
}