A single persistent variable.

This internally just uses a storage bucket so the functionality is identical to storage buckets.

You can think of this as just a single entry inside a storage bucket

Hierarchy (view full)

  • Var<number>
    • NumberVar

Properties

Methods

Properties

bucket: NumberBucket
key: string

Methods

  • Deletes the key from the database

    Returns Promise<undefined | Entry<number>>

    The deleted entry, or undefined if none

  • Fetches the current value

    Returns Promise<undefined | Entry<number>>

    The entry, or undefined if it did not exist

  • Atomically increments the value stored at key. If the entry did not exist beforehand a new one is created and set to amount

    Parameters

    • amount: number

      The amount to increment the value by

    Returns Promise<Entry<number>>

    The entry after incrementing the value

  • Store a value at the provided key in the bucket, this will overwrite the previous value stored there, if any.

    Parameters

    • value: number

      The value you're storing, for objects this will be converted to json behind the scenes

    • Optional options: SetValueOptions

      Optional options

    Returns Promise<Entry<number>>

    The storage entry

  • Similar to set but stores the value conditionally.

    Parameters

    • value: number

      The value you're storing, for objects this will be converted to json behind the scenes

    • cond: "IfExists" | "IfNotExists"

      The condition that has to pass to store the value.

      • IfExists: will only store the value if the key existed beforehand.
      • IfNotExists: will only store the value if the key did not exist.
    • Optional options: SetValueOptions

      Optional options

    Returns Promise<undefined | Entry<number>>

    Either the new entry, or undefined if the condition failed.

Generated using TypeDoc