tranger2_create_topic()
#
The tranger2_create_topic()
function creates a new topic in the TimeRanger database if it does not already exist. If the topic exists, it returns the existing topic metadata. The function ensures that the topic is properly initialized with the specified primary key, time key, system flags, and additional metadata.
Prototype
json_t *tranger2_create_topic(
json_t *tranger,
const char *topic_name,
const char *pkey,
const char *tkey,
json_t *jn_topic_ext,
system_flag2_t system_flag,
json_t *jn_cols,
json_t *jn_var
);
Parameters
Key |
Type |
Description |
---|---|---|
|
|
Pointer to the TimeRanger database instance. If the topic exists, only |
|
|
Name of the topic to be created. |
|
|
Primary key field of the topic. If not specified, the key type defaults to |
|
|
Time key field of the topic. |
|
|
JSON object containing additional topic parameters. See |
|
|
System flags for the topic, defining its behavior and properties. |
|
|
JSON object defining the topic’s columns. This parameter is owned by the function. |
|
|
JSON object containing variable metadata for the topic. This parameter is owned by the function. |
Return Value
Returns a JSON object representing the topic metadata. The returned JSON object is not owned by the caller and should not be modified or freed.
Notes
This function is idempotent, meaning that if the topic already exists, it will return the existing topic metadata instead of creating a new one. If the primary key (pkey
) is not specified, the function defaults to sf_string_key
if pkey
is defined, otherwise it defaults to sf_int_key
.
Prototype
// Not applicable in JS
Prototype
# Not applicable in Python
Examples
// TODO C examples
// TODO JS examples
# TODO Python examples