OrderedDatastore¶
OrderedDatastore
is essentially a Datastore
that stores and organizes numeric values.
It exposes a method GetSortedAsync(), which allows users to inspect entries in sorted order using a OrderedDatastorePages
object.
This OrderedDatastore
struct contains a set of functions for manipulating the stored data.Functions¶
void GetAsync(string key, function callback<boolean, string, number>)¶
SERVER ONLY
Get the latest value with the provided key, and call the callback function when the Get operation is completed
key
The key for which the value is requestedcallback
The callback function to be executed when the Get operation is completedisSuccess
This parameter indicates if the request has been successfulmessage
If the request has not been successful, you will get an error messagevalue
The value in the orderedDatastore for the given key
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
|
void SetAsync(string key, number value, function callback<boolean, string, number>)¶
SERVER ONLY
Set the latest value for the provided key, and cal the callback function when the Set operation is completed
key
The key for which the value is requested.value
The value will be set to.callback
The callback function to be executed when the Set operation is completedisSuccess
This parameter indicates if the Set operation has been successfulmessage
If the Set operation has not been successful, you will get an error messagevalue
The latest value in the orderedDatastore for the given key
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
|
void IncAsync(string key, number delta, function callback<boolean, string, number>)¶
SERVER ONLY
Increment the value for a key by the provided amount (both must be integers), and call the callback function when the Increment operation is completed
key
The key for which the value should be updateddelta
The amount to be added to the current valuecallback
The callback function to be executed when the Increment operation is completedisSuccess
This parameter indicates if the addition has been successfulmessage
If the addition has not been successful, you will get an error messagevalue
The latest value in the orderedDatastore for the given key
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
|
void RemoveAsync(string key, function callback<boolean, string, number>)¶
SERVER ONLY
Remove the value permanently, and call the callback function when the Remove operation is completed
key
The key for which the value should be removedcallback
The callback function to be executed when the Remove operation is completedisSuccess
This parameter indicates if the Remove operation has been successfulmessage
If the Remove operation has not been successful, you will get an error messagevalue
The value in the datastore prior to the Remove operation
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
|
void GetSortedAsync(boolean ascending, number pageSize, function callback<boolean, string, ...>, [number minValue], [number maxValue])¶
SERVER ONLY
Get the OrderedDatastorePages, and call the callback function when the Get operation is completed
It displays a certain range of data sorted in ascending order and the length limited by the provided pageSize
It also displays minValue/maxValue, which are optional parameters that filter the results
ascending
Whether the pages are sorted in ascending orderpageSize
The length of pagescallback
The callback function to be executed when the Get operation is completedisSuccess
This parameter indicates if the Get operation has been successfulmessage
If the Get operation has not been successful, you will an get error messageOrderedDatastorePages
The resulting OrderedDatastorePages
minValue
Optional parameter. If set, data pages with a value less than than minValue will be excludedmaxValue
Optional parameter. If set, data pages with a value greater than maxValue will be excluded
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
|