SortableDataStorage

This storage has a feature of managing integer data and bringing the aligned data. The maker and release environment do not share the storage.

# Properties

[{"index":"string Name (ReadOnly)","0":"The name of DataStorage."}]

# Methods

[{"index":"int32, List BatchDeleteAndWait(List keys) (ServerOnly) (Yield)","0":"Deletes data pertaining to the keys entered. Returns the error code and keys that were successfully deleted. Script executions are suspended during the operation."}]

[{"index":"void BatchDeleteAsync(List keys, func> callbackFunction) (ServerOnly)","0":"Deletes data with the entered keys. This operation is performed asynchronously, and the function passed to the callbackFunction is called with the deletion, error code succeeded keys when completing the operation."}]

[{"index":"int32, SortableDataStorageItemPages BatchGetAndWait(List keys) (ServerOnly) (Yield)","0":"Queries data corresponding to the keys entered. You can see the query result with the error code and the inquiry entity. Script executions are suspended during the operation."}]

[{"index":"void BatchGetAsync(List keys, func, SortableDataStorageItemPages> callbackFunction) (ServerOnly)","0":"Queries data corresponding to the keys entered. This operation is performed asynchronously, and the function passed to the callbackFunction is called with the error code, key, inquiry entity when the operation is complete."}]

[{"index":"int32, SortableDataStorageItemPages BatchGetByInfoAndWait(List keyInfos) (ServerOnly) (Yield)","0":"Queries data with the DataStorageKeyInfo entered. You can see the query result with the error code and the inquiry entity. Script executions are suspended during the operation."}]

[{"index":"void BatchGetByInfoAsync(List keyInfos, func, SortableDataStorageItemPages> callbackFunction) (ServerOnly)","0":"Queries data with the DataStorageKeyInfo entered. This operation is performed asynchronously, and the function passed to the callbackFunction is called with the error code, key, and inquiry entity for inquiry when the operation is complete."}]

[{"index":"int32, List BatchSetAndWait(Dictionary keyValues) (ServerOnly) (Yield)","0":"Saves data with the keys entered. Returns the keys that succeeded in the error code and storage. Script executions are suspended during the operation."}]

[{"index":"void BatchSetAsync(Dictionary keyValues, func> callbackFunction) (ServerOnly)","0":"Saves data with the entered keys. This operation is performed asynchronously, and the function passed to the callbackFunction is called with the error code and storage succeeded keys when completing the operation."}]

[{"index":"int32, List BatchSetByInfoAndWait(Dictionary keyValues) (ServerOnly) (Yield)","0":"Saves data with the DataStorageKeyInfo entered. Returns the DataStorageKeyInfo that succeeded in the error code and storage. Script executions are suspended during the operation."}]

[{"index":"void BatchSetByInfoAsync(Dictionary keyValues, func> callbackFunction) (ServerOnly)","0":"Saves data with the entered DataStorageKeyInfo. This operation is performed asynchronously, and the function passed to the callbackFunction is called with the error code and storage succeeded DataStorageKeyInfo when completing the operation."}]

[{"index":"int32 DeleteAndWait(string key) (ServerOnly) (Yield)","0":"Deletes data with the entered key and returns the error code. Script executions are suspended during the operation."}]

[{"index":"void DeleteAsync(string key, func callbackFunction) (ServerOnly)","0":"Deletes data with the entered keys. This operation is performed asynchronously, and the function passed to the callbackFunction is called with the error code and key upon completion of the operation."}]

[{"index":"int32, integer GetAndWait(string key) (ServerOnly) (Yield)","0":"Queries data corresponding to the keys entered. Returns the error code and the data when the operation is complete. Script executions are suspended during the operation."}]

[{"index":"void GetAsync(string key, func callbackFunction) (ServerOnly)","0":"Queries data corresponding to the keys entered. This operation is performed asynchronously, and the function passed to the callbackFunction is called with the error code, key, and data when the operation is complete."}]

[{"index":"int32, integer GetByInfoAndWait(DataStorageKeyInfo keyInfo) (ServerOnly) (Yield)","0":"Queries data with the DataStorageKeyInfo entered. You can set the detailed conditions of data to be loaded with DataStorageKeyInfo. Returns the error code and data when the operation is complete. Script executions are suspended during the operation."}]

[{"index":"void GetByInfoAsync(DataStorageKeyInfo keyInfo, func callbackFunction) (ServerOnly)","0":"Queries data with the DataStorageKeyInfo entered. You can set the detailed conditions of data to be loaded with DataStorageKeyInfo. This operation is performed asynchronously. The function passed to the callbackFunction is called with the error code, DataStorageKeyInfo, and data when the operation is complete."}]

[{"index":"int32, SortableDataStorageItemPages GetPagesAndWait(string tag) (ServerOnly) (Yield)","0":"Queries data that have the tags entered. You can see the inquiry result with the error code and inquiry entity. Script executions are suspended during the operation."}]

[{"index":"void GetPagesAsync(string tag, func callbackFunction) (ServerOnly)","0":"Queries data that have the tags entered. This operation is performed asynchronously, and the function passed to the callbackFunction is called with the error code, tag, and inquiry entity when the operation is complete."}]

[{"index":"int32, SortableDataStorageItemPages GetSortedAndWait(SortDirection sortDirection, integer min, integer max) (ServerOnly) (Yield)","0":"Queries data in the order arranged. The inquiry result displays the error code and the inquiry entity. You can set ascending and descending orders with sortDirection. You can query the data within the extent set as min and max. Script executions are suspended during the operation."}]

[{"index":"void GetSortedAsync(SortDirection sortDirection, integer min, integer max, func callbackFunction) (ServerOnly)","0":"Queries data in the order arranged. You can set ascending and descending orders with sortDirection. You can query the data within the extent set as min and max. This operation is performed asynchronously, and the function passed to the callbackFunction is called with the error code and inquiry entity when the operation is complete."}]

[{"index":"int32, DataStorageVersionPages GetVersionsAndWait(string key, SortDirection sortDirection, DateTime minDate, DateTime maxDate) (ServerOnly) (Yield)","0":"Queries the versions of data corresponding to the keys entered. Displays the inquiry results with the error code and inquiry entity. You can use sortDirection to sort in ascending or descending order. You can query the version created within the time zone set with minDate and maxDate. Suspends script executions during performance."}]

[{"index":"void GetVersionsAsync(string key, SortDirection sortDirection, DateTime minDate, DateTime maxDate, func callbackFunction) (ServerOnly)","0":"Queries the versions of data corresponding to the keys entered. You can use sortDirection to sort in ascending or descending order. You can query the version created within the time zone set with minDate and maxDate. This operation is performed asynchronously, and the function passed to the callbackFunction is called with the error code, key, and inquiry entity when the operation is complete."}]

[{"index":"int32, integer IncreaseAndWait(string key, integer delta) (ServerOnly) (Yield)","0":"Increases the data value corresponding to the key entered as much as delta. You can see the query result with the error code and the inquiry entity. Script executions are suspended during the operation."}]

[{"index":"void IncreaseAsync(string key, integer delta, func callbackFunction) (ServerOnly)","0":"Increases the data value corresponding to the key entered as much as delta. This operation is performed asynchronously, and the function passed to the callbackFunction is called with the error code, key, and the updated value."}]

[{"index":"int32 SetAndWait(string key, integer value) (ServerOnly) (Yield)","0":"Saves data with the keys entered. Returns the error code when completing the operation. Script executions are suspended during the operation."}]

[{"index":"void SetAsync(string key, integer value, func callbackFunction) (ServerOnly)","0":"Saves data with the keys entered. This operation is performed asynchronously, and the function passed to the callbackFunction is called with the error code and key when the operation is complete."}]

[{"index":"int32 SetByInfoAndWait(DataStorageKeyInfo keyInfo, integer value) (ServerOnly) (Yield)","0":"Saves data with the DataStorageKeyInfo entered. You can set the detailed information with DataStorageKeyInfo. Returns the error code when the operation is complete. Script executions are suspended during the operation."}]

[{"index":"void SetByInfoAsync(DataStorageKeyInfo keyInfo, integer value, func callbackFunction) (ServerOnly)","0":"Saves data with the DataStorageKeyInfo entered. You can set the detailed information with DataStorageKeyInfo. This operation is performed asynchronously, and the function passed to the callbackFunction is called with the error code and DataStorageKeyInfo when the operation is complete."}]

[{"index":"int32, List TransactDeleteAndWait(List keys) (ServerOnly) (Yield)","0":"Deletes data corresponding to the keys entered. Returns the keys that have been deleted along with the error code if all tasks within the call are successful. Script executions are suspended during operation. Function will not be called if any of the tasks fail. You can manipulate up to 20 keys at a time."}]

[{"index":"void TransactDeleteAsync(List keys, func> callbackFunction) (ServerOnly)","0":"Deletes data corresponding to the keys entered. This call is performed asynchronously. The function passed to the callbackFunction is called with the deleted keys and error code if all tasks within the call are successful. Function will not be called if any of the tasks fail. You can manipulate up to 20 keys at a time."}]

[{"index":"int32, List TransactSetAndWait(Dictionary keyValues) (ServerOnly) (Yield)","0":"Saves data corresponding to the keys entered. Returns the keys that have been saved along with the error code if all tasks within the call are successful. Script executions are suspended during operation. Function will not be called if any of the tasks fail. You can manipulate up to 20 keys at a time."}]

[{"index":"void TransactSetAsync(Dictionary keyValues, func> callbackFunction) (ServerOnly)","0":"Saves data corresponding to the keys entered. This call is performed asynchronously. The function passed to the callbackFunction is called with the saved keys and error code if all tasks within the call are successful. Function will not be called if any of the tasks fail. You can manipulate up to 20 keys at a time."}]

[{"index":"int32, List TransactSetByInfoAndWait(Dictionary keyValues) (ServerOnly) (Yield)","0":"Saves data with the entered DataStorageKeyInfo. Returns the DataStorageKeyInfo that succeeded and the error code if all data has been saved. Script executions are suspended during operation. Function will not be called if any of the tasks fail. You can manipulate up to 20 keys at a time."}]

[{"index":"void TransactSetByInfoAsync(Dictionary keyValues, func> callbackFunction) (ServerOnly)","0":"Saves data with the DataStorageKeyInfo entered. This call is performed asynchronously. The function passed to the callbackFunction is called with the error code and the saved DataStorageKeyInfo if all tasks within the call are successful. Function will not be called if any of the tasks fail. You can manipulate up to 20 keys at a time."}]

# Examples

#### IncreaseAndWait

This is an example of increasing a value.
    
    
    @Component
    script KeyIncrementer extends Component
        @ExecSpace("ServerOnly")
        method void OnBeginPlay()
            local ds = _DataStorageService:GetSortableDataStorage("Storage")
            
            -- If there is no value corresponding to Key, it is created with a default value and then incremented by 1.
            local errorCode, value = ds:IncreaseAndWait("Key", 1)
        end
    end
    

#### IncreaseAsync

This is an example of incrementing a value asynchronously.
    
    
    @Component
    script DataStoreIncrementer extends Component
        @ExecSpace("ServerOnly")
        method void OnBeginPlay()
            local ds = _DataStorageService:GetSortableDataStorage("Storage")
            
            ds:IncreaseAsync("Key", 1, function(errorCode, key, value)
                -- It will be called when the operation is completed.
            end)
        end
    end
    

#### GetSortedAndWait

This example looks up data in the arranged order.
    
    
    @Component
    script SortedDataIterator extends Component
        @ExecSpace("ServerOnly")
        method void OnBeginPlay()
            local ds = _DataStorageService:GetSortableDataStorage("Storage")
            
            -- Retrieves data in the arranged order.
            local errorCode, itemPages = ds:GetSortedAndWait(SortDirection.Ascending, 0, 1000)
            
            while true do
                -- You can get a list of current pages with GetCurrentPageDatas().
                local items = itemPages:GetCurrentPageDatas()
                for _, item in pairs(items) do
                     -- You can look up Key and Value values through SortableDataStorageItem.
                    log(item.KeyInfo.Key)
                    log(item.KeyInfo.Tag)
                    log(item.KeyInfo.Version)
                    log(item.Value) 
                end
            
                -- You can check if the current page is the last page using the IsLastPage property.
                if itemPages.IsLastPage == true then
                    break
                end
            
                -- You can move to the next page using MoveToNextPageAndWait().
                itemPages:MoveToNextPageAndWait()
            end
        end
    end
    

# SeeAlso

  * DataStorageService