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.

Methods

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.

inline getList ():Map<String, Dynamic>

Returns the raw Map of block contents.

Returns:

Map of block contents.

getListCopy ():Map<String, Dynamic>

Returns a copy of the raw Map of block contents. This should be used in case when you need to send block contents to the slave server manually in uniserver mode.

Returns:

A copy of the Map of block contents.

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: "$". In this case array element with index "index" will be set to the given value.

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.

inline updated ():Void

Marks this block as updated. This method needs to be called if block contents were changed manually instead of using set() or having been updated from the slave server.