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
keyThe key for which the value is requestedcallbackThe callback function to be executed when the Get operation is completedisSuccessThis parameter indicates if the request has been successfulmessageIf the request has not been successful, you will get an error messagevalueThe 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
keyThe key for which the value is requested.valueThe value will be set to.callbackThe callback function to be executed when the Set operation is completedisSuccessThis parameter indicates if the Set operation has been successfulmessageIf the Set operation has not been successful, you will get an error messagevalueThe 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
keyThe key for which the value should be updateddeltaThe amount to be added to the current valuecallbackThe callback function to be executed when the Increment operation is completedisSuccessThis parameter indicates if the addition has been successfulmessageIf the addition has not been successful, you will get an error messagevalueThe 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
keyThe key for which the value should be removedcallbackThe callback function to be executed when the Remove operation is completedisSuccessThis parameter indicates if the Remove operation has been successfulmessageIf the Remove operation has not been successful, you will get an error messagevalueThe 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
ascendingWhether the pages are sorted in ascending orderpageSizeThe length of pagescallbackThe callback function to be executed when the Get operation is completedisSuccessThis parameter indicates if the Get operation has been successfulmessageIf the Get operation has not been successful, you will an get error messageOrderedDatastorePagesThe resulting OrderedDatastorePages
minValueOptional parameter. If set, data pages with a value less than than minValue will be excludedmaxValueOptional 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 | |