treedb_list_instances()

treedb_list_instances()#

treedb_list_instances() returns a list of instances from a specified topic in a tree database, optionally filtered by a given JSON filter and a custom match function.

Prototype

json_t *treedb_list_instances(
    json_t *tranger,
    const char *treedb_name,
    const char *topic_name,
    const char *pkey2_name,
    json_t *jn_filter,  // owned
    BOOL (*match_fn) (
        json_t *topic_desc, // NOT owned
        json_t *node,       // NOT owned
        json_t *jn_filter   // NOT owned
    )
);

Parameters

Key

Type

Description

tranger

json_t *

A reference to the tranger database instance.

treedb_name

const char *

The name of the tree database.

topic_name

const char *

The name of the topic from which instances are retrieved.

pkey2_name

const char *

The secondary key name used to identify instances.

jn_filter

json_t *

A JSON object containing filter criteria. This parameter is owned by the function.

match_fn

BOOL (*)(json_t *, json_t *, json_t *)

A function pointer to a custom match function that determines whether an instance matches the filter criteria.


Return Value

A JSON array containing the list of matching instances. The caller must decrement the reference count when done.

Notes

The returned list must be decref’d by the caller to avoid memory leaks. Filtering is applied using both jn_filter and match_fn if provided.

Prototype

// Not applicable in JS

Prototype

# Not applicable in Python
Examples
// TODO C examples
// TODO JS examples
# TODO Python examples