Class Table

Hierarchy

Constructors

Properties

_database: Database
autoDecrypt: Boolean
options?: DatabaseOptions
readyInDate: Date
tableName: string

Accessors

  • get uptime(): number
  • Returns number

    Description

    Returns database connection uptime!

    Example

    console.log(`Database is up for ${db.uptime} ms.`);
    

Methods

  • Parameters

    • key: string

      Data key

    • value: ElementValue

      The value, must be a number

    Returns Promise<undefined | void | ElementValue>

    Example

    <db>.add(`data`,2)
    
  • Parameters

    • limit: number = 0

      default = 0

    Returns Promise<{
        ID: string;
        data: ElementValue;
    }[]>

    Description

    Returns all elements in Database

    Example

    <db>.all()
    
  • Parameters

    • key: string

      Type a key for the element

    Returns Promise<undefined | string>

    Promise

    Description

    delete element from database

    Example

    <db>.delete(`version`)
    
  • Parameters

    • key: string

      Data key

    Returns Promise<undefined | void | ElementValue>

    Example

    <db>.double("coins")
    
  • Parameters

    • key: string

    Returns Promise<Element[]>

    Description

    Check if the key ends with the key in the database

    Example

    <db>.endsWith({key:`st.db`})
    
  • Parameters

    • key: string

      Type a key for the element

    Returns Promise<void | ElementValue>

    Description

    To fetch the value of a specific key element

    Example

    <db>.fetch(`version`)
    
  • Parameters

    • key: string
    • callback: ((element, index, elements) => Element)
        • (element, index, elements): Element
        • Parameters

          • element: Element
          • index: Number
          • elements: Element[]

          Returns Element

    Returns Promise<Element[]>

    Description

    Filter the database by the key

    Example

    <db>.filter(t => t == "test")
    
  • Parameters

    • key: string

      Type a key for the element

    Returns Promise<void | ElementValue>

    Boolean

    Description

    To get the value of a specific key element

    Example

    <db>.get(`version`)
    
  • Parameters

    • key: string

      Type a key for the element

    Returns Promise<boolean>

    Description

    Checking an item from the database if it exists or not

    Example

    <db>.has(`version`)
    
  • Parameters

    • key: string

    Returns Promise<Element[]>

    Description

    Check if the key includes with the key in the database

    Example

    <db>.includes({key:`st.db`})
    
  • Parameters

    • key: string

      Data key

    • Optional operator: "/" | "-" | "+" | "*"

      One of +, -, %, * or /

    • Optional new_value: string | number

    Returns Promise<undefined | void | ElementValue>

    Description

    Does a math calculation and stores the value in the database!

    Example

    db.math("points","+",150)
    
  • Parameters

    • key: string

      Data key

    • value: ElementValue

      The value, must be a number

    Returns Promise<undefined | void | ElementValue>

    Example

    <db>.multiply("coins", 2)
    
  • Parameters

    • key: string

    Returns Promise<undefined | ElementValue>

    Description

    Removes the last element of the array

    Example

    <db>.pop(`hello`)
    
  • Parameters

    • key: string

      Type a key for the element

    • value: ElementValue

    Returns Promise<undefined | ElementValue>

    Description

    To pull an element from an array into data

    Example

    <db>.pull(`version`,"v6")
    
  • Parameters

    • key: string

      Type a key for the element

    • value: ElementValue

    Returns Promise<undefined | ElementValue>

    Description

    To push an element to an array into data

    Example

    <db>.push(`version`,"v6")
    
  • Parameters

    • key: any

      Type a key for the element

    Returns Promise<undefined | void | ElementValue>

    Description

    delete element from database

    Example

    <db>.delete(`version`})
    
  • Parameters

    • key: string

      Type a key for the element

    • value: ElementValue

      Type a value for the element

    Returns Promise<undefined | ElementValue>

    Description

    set element in database

    Example

    <db>.set({key:`version`,value:"v6"})
    
  • Parameters

    • key: string

    Returns Promise<undefined | ElementValue>

    Description

    Removes the first element of the array

    Example

    <db>.shift(`hello`)
    
  • Parameters

    • key: string

    Returns Promise<Element[]>

    Description

    Check if the key starts with the key in the database

    Example

    <db>.startsWith({key:`st.db`})
    
  • Parameters

    • key: string

      Data key

    • value: ElementValue

      The value, must be a number

    Returns Promise<undefined | void | ElementValue>

    Example

    <db>.subtract("coins", 50)
    
  • Parameters

    • key: string

      Type a key for the element

    Returns Promise<ElementValue>

    Description

    To get the value type of a given key element

    Example

    <db>.type(`st.db`)
    
  • Parameters

    • key: string

      Type a key for the element

    • value: ElementValue

    Returns Promise<undefined | ElementValue>

    Description

    To unshift an element to an array into data

    Example

    <db>.unshift(`version`,["v6"])
    

Discord Support Server