Datastore API
Notes
- For all functions, enter the parameters in the order listed.
- Italicized parameters are optional.
- Received Events are events of the "wrangler" domain that Wrangler will respond to
- Raised Events are events that can be selected on within any ruleset in the pico when they occur
- Sent Events are events that the pico will send elsewhere as a result of triggering a Wrangler event.
"io.picolabs.ds" must be installed on your pico for these to work Returns the value mapped to the key under the given domain. A KRL value. Can be NULL. Returns The value located for the key-value combination under that domain. Can be null if the value does not exist. Returns all the key-value mappings for a certain datastore domain as a KRL map. Returns the entire datastore as a KRL map. None Returns A KRL map representing the entire datastore. Domains are mapped to maps of key-value pairs. This event is used to update the datastore asynchronously. key Will return empty directives. Used to clear a value in the datastore. Has the same effect as passing nothing to the value attribute in wrangler:ds_update. Will return empty directives. wrangler:ds_assign_map_to_domain This event is used to update all data under a given domain. It takes a KRL map of key-value pairings to use as the new data for that domain. wrangler:ds_domain_updated is raised as a response. This event should be used sparingly, such as for migration purposes. Raised as a response to wrangler:ds_update. It informs the listener of the new value in the datastore for the given domain and key. Raised as a response to wrangler:ds_assign_map_to_domain. It informs the listener that all values for a domain have been updated with an entirely new map.Functions
getItem
Returns
Parameters
Parameter Datatype Description domain String The domain to query key String The key mapped to a requested value item = getItem(meta:rid, numUsers)
/*
3723
*/
allDomainData
Parameters
Parameter Datatype Description domain String The domain of the data to query for viewStore
Parameters
Received Events
ds_update
wrangler:ds_update
Attributes
Attribute Datatype Description domain String The domain of data to update String The key whose corresponding value will be updated value Any The new value for the datastore entry. Directives Returned
Corresponding Raised Events
ds_clear_data
wrangler:ds_clear_data
Attributes
Attribute Datatype Description domain String The domain of data to update key String The key whose corresponding value will be deleted Directives Returned
ds_assign_map_to_domain
Attribute Datatype Description domain String The domain of data to update with the map map Map The new key-value mappings for the given domain Corresponding Raised Events
Raised Events
ds_updated
wrangler:ds_updated
Attribute Datatype Description domain String The domain of the updated data key String The key for the updated data value Any The new value for the data at the given domain and key ds_updated
wrangler:ds_domain_updated
Attribute Datatype Description domain String The domain whose data has been updated
Copyright Picolabs | Licensed under Creative Commons.