Data block.
You can get or create it from the appropriate data Cache
through the CacheManager
API.
Data blocks are described in detail in
Data Blocks article.
get (group:String, key:String):Null<Dynamic>
Returns block attribute value.
If group
is null, return block row attribute.
Parameters:
group
Attribute group. Will get the nested attribute params.group
.key
.
key
Attribute name.
Returns:
Attribute value. Returns null if the attribute is not found.
getBool (group:String, key:String):Bool
Returns block attribute value as Bool
.
If group
is null, return block row attribute.
Parameters:
group
Attribute group. Will get the nested attribute params.group
.key
.
key
Attribute name.
Returns:
Attribute value. Returns false if the attribute is not found.
getFloat (group:String, key:String):Float
Returns block attribute value as Float
.
If group
is null, return block row attribute.
Parameters:
group
Attribute group. Will get the nested attribute params.group
.key
.
key
Attribute name.
Returns:
Attribute value. Returns 0 if the attribute is not found.
getInt (group:String, key:String):Int
Returns block attribute value as Int
.
If group
is null, return block row attribute.
Parameters:
group
Attribute group. Will get the nested attribute params.group
.key
.
key
Attribute name.
Returns:
Attribute value. Returns 0 if the attribute is not found.
getListCopy ():Map<String, Dynamic>
inline getString (group:String, key:String):String
Returns block attribute value as String
.
If group
is null, return block row attribute.
Parameters:
group
Attribute group. Will get the nested attribute params.group
.key
.
key
Attribute name.
Returns:
Attribute value. Returns null if the attribute is not found.
set (group:String, key:String, val:Dynamic):Void
Sets block attribute value and increases version number.
You will still need to call CacheManager.updated()
to mark the block for saving.
Parameters:
group
Attribute group. Can be one of the following:
null - Database row attribute.
<group>
- Will set the following attribute: params.<group>.<key>
.
If the group does not exist, will initialize it.
key
Attribute name.
Supports the following naming scheme for setting array elements: "
val
Attribute value.
setFromRow (row:Dynamic, hasParams:Bool, paramsFormat:String):Void
Sets the contents of this block from database row.
This should only be used in Cache.load()
in the case of custom format.
Parameters:
row
Anonymous object representing database row.
hasParams
If enabled, will parse params
field as a string containing serialized object.
paramsFormat
params
field format. Supported formats are haxe
and json
.