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

    Interface FileCpu

    interface FileCpu {
        add(file: string, config: Add, opts?: any): Promise<void>;
        find(file: string, config: Find, opts?: any): Promise<DataInternal[]>;
        findOne(
            file: string,
            config: FindOne,
            opts?: any,
        ): Promise<false | DataInternal>;
        remove(
            file: string,
            config: Remove,
            one: boolean,
            opts?: any,
        ): Promise<DataInternal[]>;
        update(
            file: string,
            config: Update,
            one: boolean,
            opts?: any,
        ): Promise<DataInternal[]>;
    }

    Implemented by

    Index
    • Asynchronously adds an entry to a file.

      Parameters

      • file: string
      • config: Add
      • Optionalopts: any

      Returns Promise<void>

      A promise resolving to void.

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

      Parameters

      • file: string
      • config: Find
      • Optionalopts: any

      Returns Promise<DataInternal[]>

      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
      • config: FindOne
      • Optionalopts: any

      Returns Promise<false | DataInternal>

      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
      • config: Remove
      • one: boolean

        If true, removes only the first matching entry.

      • Optionalopts: any

      Returns Promise<DataInternal[]>

      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
      • config: Update
      • one: boolean

        If true, updates only the first matching entry.

      • Optionalopts: any

      Returns Promise<DataInternal[]>

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