Created
December 12, 2011 19:15
-
-
Save 2garryn/1468643 to your computer and use it in GitHub Desktop.
Test code to create tree
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fill_elem_tree(C, AppIntId, ElemId) -> | |
case db:get(C, AppIntId, ElemId) of | |
{error, not_found} -> | |
{error, {?MODULE, no_value}}; | |
Value -> | |
ResultRec = wac_lib:from_binary(term, Value), | |
ChildsRec = [fill_elem_tree(C, AppIntId, ChildElId) || | |
ChildElId <- ResultRec#elem.childs], | |
#elem_info{id = ResultRec#elem.id, | |
name = ResultRec#elem.name, | |
element_type = ResultRec#elem.element_type, | |
description = ResultRec#elem.description, | |
var_type = ResultRec#elem.var_type, | |
permissions = ResultRec#elem.permissions, | |
timeout = ResultRec#elem.timeout, | |
childs = ChildsRec, | |
name_tree = ResultRec#elem.tree} | |
end. | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment