treedb_link_nodes()
#
The treedb_link_nodes()
function establishes a hierarchical relationship between a parent node and a child node using the specified hook.
Prototype
int treedb_link_nodes(
json_t *tranger,
const char *hook,
json_t *parent_node, // NOT owned, pure node
json_t *child_node // NOT owned, pure node
);
Parameters
Key |
Type |
Description |
---|---|---|
|
|
A reference to the tranger database instance. |
|
|
The name of the hook defining the relationship between the parent and child nodes. |
|
|
The parent node to which the child node will be linked. This parameter is not owned by the function. |
|
|
The child node that will be linked to the parent node. This parameter is not owned by the function. |
Return Value
Returns 0
on success, or a negative error code if the operation fails.
Notes
The function does not take ownership of parent_node
or child_node
. Ensure that both nodes exist and are valid before calling treedb_link_nodes()
.
Prototype
// Not applicable in JS
Prototype
# Not applicable in Python
Examples
// TODO C examples
// TODO JS examples
# TODO Python examples