dsc.db
    Preparing search index...

    Class Database<T>

    Type Parameters

    • T

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    connection: Connection
    options: Options
    schema: Model<Data<T>, any, any>

    Methods

    • Sum numbers to the key

      Parameters

      • key: string

        The key to sum to

      • amount: number

        Number to sum

      Returns Promise<Data<T> | null>

      The data response from the database

      database.add('key', 1);
      
    • Deletes data from the database

      Parameters

      • query: string | _QueryFilter<{ [key: string]: any }>

        The query to delete

      Returns Promise<Data<T> | null>

      The data response from the database

      database.delete('key');
      
    • Divide numbers from the key

      Parameters

      • key: string

        The key to divide from

      • divideBy: number

        Number to divide the key by

      Returns Promise<Data<T> | null>

      The data response from the database

      database.div('key', 4);
      
    • Fetches raw data from the database

      Parameters

      • query: string | _QueryFilter<{ [key: string]: any }>

        The query to search for

      Returns Promise<Data<T> | null>

      The raw data from the database

      database.fetch('key');
      
    • Checks if the data exists

      Parameters

      • key: string

        The key to check

      Returns Promise<boolean>

      The data response from the database

      database.has('key')
      
    • Fetches all data from the database as an array

      Returns Promise<Data<T>[] | null>

      The data response from the database

      database.list();
      
    • Pull data from an array

      Parameters

      • key: string

        The key to pull the data

      • value: any

        The data to pull

      • multiple: boolean = false

        If true, it will pull multiple data with same key from the array

      Returns Promise<Data<T> | null>

      The data response from the database

      database.pull('key', 'value');
      
    • Pushes data to an array

      Parameters

      • key: string

        The key to push the data

      • value: any

        The value to push

      Returns Promise<Data<T> | null>

      The data response from the database

      database.push('key', 'value');
      database.push('key', ['value1', 'value2']);
      database.push('key', { key: 'value' });
      database.push('key', [{ key: 'value' }, { key: 'value' }]);
      database.push('key', 1);
      database.push('key', [1, 2]);
    • Set/Update/Create data on the database

      Parameters

      • key: string

        The key to set the data

      • value: any

      Returns Promise<Data<T>>

      The data response from the database

      database.set('key', 'value');
      database.set('key', ['value1', 'value2']);
      database.set('key.secondKey', { data: 'value' });
    • Subtract numbers from the key

      Parameters

      • key: string

        The key to subtract fro

      • amount: number

        Number to subtract

      Returns Promise<Data<T> | null>

      The data response from the database

      database.subtract('key', 1);