rex_firebase_itemtable
Plugin, ACE table, Discussion thread
Dependence: rex_firebase_apiV3
Dependence: rex_firebase_apiV3
Introduction
Items table indexed by (itemID, key), supports writing a item or reading items back.
Items table indexed by (itemID, key), supports writing a item or reading items back.
Usage
Concept
Each item is a 1d hash table i.e key-value pair like dictionary, and it is indexed by an unique ID named itemID.
So that a item table is a 2d hash table indexed by itemID and key.
Each item is a 1d hash table i.e key-value pair like dictionary, and it is indexed by an unique ID named itemID.
So that a item table is a 2d hash table indexed by itemID and key.
Save a item
Prepare saved values
Prepare saved values in key-value pairs by these actions
Prepare saved values
Prepare saved values in key-value pairs by these actions
- Action:Set value (value could be number or string, or JSON string which will be parsed to a JSON object)
- Action:Set boolean value
- Action:Set to timestamp (set server timestamp value into current item)
- Action:Set to position (Set position value into current item with key "pos")
- Action:Remove key
Save item
After prepared, call "Action:Save"to save the specific item. Or call "Action:Push" to append a new item into table, then get the itemID by "Expression:LastItemID". Set parameter "ID" to an empty string "" in "Action:Save" will be equal to "Action:Push".
Set parameter "Set mode" to "Update" will only overwrite prepared key-value pairs. Set "Set mode" to "Set" will clean all then write these key-value pairs.
"Condition:On save complete" will be triggered if save completed, otherwise "Condition:On save error" will be triggered.
After prepared, call "Action:Save"to save the specific item. Or call "Action:Push" to append a new item into table, then get the itemID by "Expression:LastItemID". Set parameter "ID" to an empty string "" in "Action:Save" will be equal to "Action:Push".
Set parameter "Set mode" to "Update" will only overwrite prepared key-value pairs. Set "Set mode" to "Set" will clean all then write these key-value pairs.
"Condition:On save complete" will be triggered if save completed, otherwise "Condition:On save error" will be triggered.
Generate itemID
Each saved item has an itemID which could be assigned manually, or generated within "Action:Push".
ItemID also could be generated "Action:Generate" without saving item. Get the last generated itemID by "Expression:LastGeneratedKey". Or get generated itemID by "Expression:GenerateKey".
Each saved item has an itemID which could be assigned manually, or generated within "Action:Push".
ItemID also could be generated "Action:Generate" without saving item. Get the last generated itemID by "Expression:LastGeneratedKey". Or get generated itemID by "Expression:GenerateKey".
Action:Generate -> Expression:LastGeneratedKey
or
Expression:GenerateKey
Load items
Request loading
Follow these two steps to start loading items -
Request loading
Follow these two steps to start loading items -
- Call "Action:Add itemID" to append itemID for loading
- Call "Action:Load" to load these items by itemID
Loading completed
"Condition:On load complete" will be triggered when received these loaded items. Designer could -
"Condition:On load complete" will be triggered when received these loaded items. Designer could -
- Get each item by "Condition:For each itemID" then get each key of a item by "Condition:For each key". Each itemID, key, and value could be got by "Expression:CurItemID", "Expression:CurKey", and "Expression:CurValue". ( Sample capx , sample capx v3 )
- Get a specific value by "Expression:At", the two parameters are ItemID and key.
- Export these items in JSON string by "Expression:LoadResultToJSON". It could be imported into Yann's JSON plugin.
Remove a item
Call "Action:Remove" to remove a item.
"Condition:On remove complete" will be triggered if save completed, otherwise "Condition:On remove error" will be triggered.
Call "Action:Remove" to remove a item.
"Condition:On remove complete" will be triggered if save completed, otherwise "Condition:On remove error" will be triggered.
On disconnect
Sample capx - presence , sample capx v3
There are some actions could be ran while client is disconnected. Use them before item saved.
Sample capx - presence , sample capx v3
There are some actions could be ran while client is disconnected. Use them before item saved.
- Action:Auto remove - remove item when disconnected
Reference: rex_firebase_itemmonitor plugin
Querying
This plugin does not support querying, using rex_firebase_itemfilter for querying.
This plugin does not support querying, using rex_firebase_itemfilter for querying.