treedb_create_topic()
#
treedb_create_topic()
creates a new topic in the TreeDB with the specified schema and primary key constraints.
Prototype
json_t *treedb_create_topic(
json_t *tranger,
const char *treedb_name,
const char *topic_name,
int topic_version,
const char *topic_tkey,
json_t *pkey2s, // owned, string or dict of string | [strings]
json_t *jn_cols, // owned
uint32_t snap_tag,
BOOL create_schema
);
Parameters
Key |
Type |
Description |
---|---|---|
|
|
Pointer to the tranger instance managing the TreeDB. |
|
|
Name of the TreeDB where the topic will be created. |
|
|
Name of the topic to be created. |
|
|
Version number of the topic schema. |
|
|
Topic key used for indexing. |
|
|
Primary key(s) for the topic, either a string or a dictionary of strings. |
|
|
JSON object defining the schema of the topic, including field types and attributes. |
|
|
Snapshot tag associated with the topic creation. |
|
|
Flag indicating whether to create the schema if it does not exist. |
Return Value
Returns a JSON object representing the created topic. WARNING: The returned object is not owned by the caller.
Notes
The primary key (pkey
) of all topics must be id
.
This function does not load hook links.
The returned JSON object should not be modified or freed by the caller.
Prototype
// Not applicable in JS
Prototype
# Not applicable in Python
Examples
// TODO C examples
// TODO JS examples
# TODO Python examples