@wxn0brp/db-core
    Preparing search index...

    Class ValtheraClass

    Represents a database management class for performing CRUD operations.

    Hierarchy (View Summary)

    Implements

    Index
    _collections: Map<string, Collection<any>> = ...
    _plugins: ValtheraPlugin[] = []
    adapter: ActionsBase
    emitter: VEE<
        {
            add(query: VQuery, result: unknown): void;
            bulkAdd(query: VQuery, result: unknown[]): void;
            count(query: VQuery, result: number): void;
            createIndex(query: VQuery, result: void): void;
            ensureCollection(query: VQuery, result: boolean): void;
            find(query: VQuery, result: unknown[]): void;
            findOne(query: VQuery, result: unknown): void;
            getCollections(query: VQuery, result: string[]): void;
            issetCollection(query: VQuery, result: boolean): void;
            remove(query: VQuery, result: unknown[]): void;
            removeCollection(query: VQuery, result: boolean): void;
            removeIndex(query: VQuery, result: void): void;
            removeOne(query: VQuery, result: unknown): void;
            toggleOne(query: VQuery, result: ToggleOneResult<unknown>): void;
            update(query: VQuery, result: unknown[]): void;
            updateOne(query: VQuery, result: unknown): void;
            updateOneOrAdd(query: VQuery, result: UpdateOneOrAddResult<unknown>): void;
        } & {
            "*": (
                name:
                    | "find"
                    | "count"
                    | "getCollections"
                    | "ensureCollection"
                    | "issetCollection"
                    | "add"
                    | "findOne"
                    | "update"
                    | "updateOne"
                    | "remove"
                    | "removeOne"
                    | "removeCollection"
                    | "updateOneOrAdd"
                    | "toggleOne"
                    | "createIndex"
                    | "removeIndex"
                    | "bulkAdd",
                query: VQuery,
                result: any,
            ) => void;
        },
    > = ...
    options: DbOpts
    version: string = version
    • Add data to a database.

      Type Parameters

      Parameters

      Returns Promise<T>

    • Parameters

      • ...args: any[]

      Returns Promise<any>

    • Create an index on a collection.

      Parameters

      • collection: string
      • fields: string[]
      • Optionalopts: IndexOpts

      Returns Promise<void>

    • Check and create the specified collection if it doesn't exist.

      Parameters

      • collection: string

      Returns Promise<boolean>

    • Get the names of all available databases.

      Returns Promise<string[]>

    • Parameters

      • ...args: any[]

      Returns Promise<any>

    • Check if a collection exists.

      Parameters

      • collection: string

      Returns Promise<boolean>

    • Parameters

      Returns () => void

    • Removes a database collection from the database.

      Parameters

      • collection: string

      Returns Promise<boolean>

    • Remove an index from a collection. Adapter-dependent.

      Parameters

      • collection: string
      • fields: string[]

      Returns Promise<void>

    • Experimental

      Executes operations within a transaction. Automatically rolls back on error.

      Receives a transaction-scoped object (tx) whose operations are executed within the transaction context.

      This feature is highly experimental and may change or be removed at any time.

      • Transaction support depends on the adapter implementation.
      • Collections must be declared upfront to ensure proper locking.
      • Operations invoked via the original db reference are NOT part of the transaction.

      Type Parameters

      • T

      Parameters

      Returns Promise<T>