神岛 API 文档 - ArenaPro版
    Preparing search index...

    Class GameDataStorage<T>

    游戏数据存储类,用于对特定存储空间内的数据进行操作。

    Game data storage class, used for operating on data within a specific storage space.

    存储数据的类型。

    The type of data being stored.

    Type Parameters

    • T

    Implements

    • GameDataStorage
    Index

    Properties

    destroy: () => Promise<void>

    Type declaration

    销毁此数据存储空间,并删除所有数据。

    Destroys this data storage space and deletes all of its data.

    返回一个 Promise,在销毁完成后解析。

    Returns a Promise that resolves when the destruction is complete.

    get: (key: string) => Promise<ReturnValue<T>>

    Type declaration

      • (key: string): Promise<ReturnValue<T>>
      • Parameters

        • key: string

        Returns Promise<ReturnValue<T>>

    获取指定键的值。

    Gets the value of a specified key.

    需要获取的键。

    The key to get.

    返回一个 Promise,解析为获取操作的结果。

    Returns a Promise that resolves to the result of the get operation.

    increment: (key: string, value?: number) => Promise<number>

    Type declaration

      • (key: string, value?: number): Promise<number>
      • Parameters

        • key: string
        • Optionalvalue: number

        Returns Promise<number>

    以原子方式递增给定键的值。如果键不存在,则会创建并设置初始值。如果对应的值不是数字,则会报错。 通过此方式修改值时不会触发数据锁定。

    Atomically increments the value of a given key. If the key does not exist, it is created and set. An error is thrown if the corresponding value is not a number. Modifying a value this way does not trigger a data lock.

    需要递增的键。

    The key to increment.

    递增量,默认为 1。

    The amount to increment by, defaults to 1.

    返回一个 Promise,解析为累加后的数值。

    Returns a Promise that resolves to the incremented numerical value.

    key: string

    数据存储空间的名称。

    The name of the data storage space.

    list: (options: ListPageOptions) => Promise<QueryList<T>>

    Type declaration

    根据指定选项获取数据列表。

    Retrieves a list of data based on the specified options.

    分页和排序选项。

    Pagination and sorting options.

    返回一个 Promise,解析为查询结果列表。

    Returns a Promise that resolves to the query list result.

    remove: (key: string) => Promise<ReturnValue<T>>

    Type declaration

      • (key: string): Promise<ReturnValue<T>>
      • Parameters

        • key: string

        Returns Promise<ReturnValue<T>>

    删除指定键的数据。

    Removes the data for a specified key.

    需要删除的键。

    The key to remove.

    返回一个 Promise,解析为被删除的数据。

    Returns a Promise that resolves to the removed data.

    set: (key: string, value: T) => Promise<void>

    Type declaration

      • (key: string, value: T): Promise<void>
      • Parameters

        • key: string
        • value: T

        Returns Promise<void>

    设置指定键的值。

    Sets the value for a specified key.

    需要设置的键。

    The key to set.

    需要设置的值。

    The value to set.

    返回一个 Promise,在设置完成后解析。

    Returns a Promise that resolves when the set operation is complete.

    update: (
        key: string,
        handler: (prevValue: ReturnValue<T>) => T,
    ) => Promise<void>

    Type declaration

      • (key: string, handler: (prevValue: ReturnValue<T>) => T): Promise<void>
      • Parameters

        • key: string
        • handler: (prevValue: ReturnValue<T>) => T

        Returns Promise<void>

    使用处理器函数更新指定键的值。

    Updates the value of a specified key using a handler function.

    需要更新的键。

    The key to update.

    一个接收旧值并返回新值的处理器函数。

    A handler function that receives the previous value and returns the new value.

    返回一个 Promise,在更新完成后解析。

    Returns a Promise that resolves when the update is complete.