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

    Interface default

    interface default {
        add(file: string, data: Data): Promise<void>;
        find(
            file: string,
            search: Search,
            context?: VContext,
            findOpts?: FindOpts,
        ): Promise<false | any[]>;
        findOne(
            file: string,
            search: Search,
            context?: VContext,
            findOpts?: FindOpts,
        ): Promise<any>;
        remove(
            file: string,
            one: boolean,
            search: Search,
            context?: VContext,
        ): Promise<boolean>;
        update(
            file: string,
            one: boolean,
            search: Search,
            updater: Updater,
            context?: VContext,
        ): Promise<boolean>;
    }

    Implemented by

    Index

    Methods

    • Asynchronously adds an entry to a file.

      Parameters

      • file: string

        The path to the file.

      • data: Data

        The data to add.

      Returns Promise<void>

      A promise resolving to void.

    • Asynchronously finds multiple entries in a file based on search criteria.

      Parameters

      • file: string

        The path to the file.

      • search: Search

        The search criteria.

      • Optionalcontext: VContext

        Additional context for the search.

      • OptionalfindOpts: FindOpts

        Additional options for searching.

      Returns Promise<false | any[]>

      A promise resolving to an array of found entries, or false if the file does not exist.

    • Asynchronously finds one entry in a file based on search criteria.

      Parameters

      • file: string

        The path to the file.

      • search: Search

        The search criteria.

      • Optionalcontext: VContext

        Additional context for the search.

      • OptionalfindOpts: FindOpts

        Additional options for searching.

      Returns Promise<any>

      A promise resolving to the found entry or false if not found.

    • Asynchronously removes entries from a file based on search criteria.

      Parameters

      • file: string

        The path to the file.

      • one: boolean

        If true, removes only the first matching entry.

      • search: Search

        The search criteria.

      • Optionalcontext: VContext

        Additional context for the operation.

      Returns Promise<boolean>

      A promise resolving to true if at least one entry was removed, otherwise false.

    • Asynchronously updates entries in a file based on search criteria and an updater function or object.

      Parameters

      • file: string

        The path to the file.

      • one: boolean

        If true, updates only the first matching entry.

      • search: Search

        The search criteria.

      • updater: Updater

        The updater function or object.

      • Optionalcontext: VContext

        Additional context for the operation.

      Returns Promise<boolean>

      A promise resolving to true if at least one entry was updated, otherwise false.