tagion_hibon_add_document

Add document to hibon

extern (C)
int
tagion_hibon_add_document
(,
const char* key
,
const size_t key_len
,
const(uint8_t*) buf
,
const size_t buf_len
)

Parameters

instance HiBONT*

pointer to the hibon instance

key char*

pointer to the key

key_len size_t

length of the key

buf const(uint8_t*)

pointer to the document buffer

buf_len size_t

length of the buffer

Return Value

Type: int

ErrorCode

Examples

auto sub_hibon = new HiBON;
sub_hibon["sub_doc"] = "test";
const doc = Document(sub_hibon);

HiBONT h;
int rt = tagion_hibon_create(&h);
assert(rt == ErrorCode.none, "could not create hibon");
string key = "some_key";

rt = tagion_hibon_add_document(&h, &key[0], key.length, &doc.data[0], doc.data.length);
HiBON string_hibon = cast(HiBON) h.hibon;
assert(string_hibon[key].get!Document == doc);