tagion_document_get_record_name

Get document record type name of a document

extern (C)
int
tagion_document_get_record_name
(
const uint8_t* buf
,
const size_t buf_len
,,)

Parameters

buf uint8_t*

The document buffer pointer

buf_len size_t

Length of document buffer

record_name char**

The returned record name string

record_name_len size_t*

The length of the returned record name

Return Value

Type: int

ErrorCode

Examples

import tagion.hibon.HiBONRecord : recordType, HiBONRecord;
enum some_record = "SomeRecord";
@recordType(some_record)
static struct S {
    int test;
    mixin HiBONRecord;
}
S s;
s.test = 5;
const doc = s.toDoc;

char* record_name_value;
size_t record_name_len;
int rt = tagion_document_get_record_name(&doc.data[0], doc.data.length, &record_name_value, &record_name_len);
assert(rt == ErrorCode.none);

const record_name = record_name_value[0..record_name_len];
assert(record_name == some_record);