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

    Interface FileCpu

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

    Implemented by

    Index

    Methods

    • Asynchronously adds an entry to a file.

      Parameters

      • file: string
      • config: Add

      Returns Promise<void>

      A promise resolving to void.

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

      Parameters

      • file: string
      • config: Find

      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

      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.

      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.

      Returns Promise<DataInternal[]>

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