tagion_hibon_add_binary

Add binary data to hibon instance

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

Parameters

instance const(HiBONT*)

pointer to the instance

key char*

pointer to the key

key_len size_t

key length

buf uint8_t*

pointer to the buffer to insert.

buf_len size_t

length of the buffer

Return Value

Type: int

Examples

HiBONT h;
int rt = tagion_hibon_create(&h);
assert(rt == ErrorCode.none, "could not create hibon");
string key = "some_key";
immutable(ubyte[]) binary_data = [0, 1, 0, 1];
rt = tagion_hibon_add_binary(&h, &key[0], key.length, &binary_data[0], binary_data.length);
assert(rt == ErrorCode.none);
HiBON result = cast(HiBON) h.hibon;
assert(result[key].get!(immutable(ubyte[])) == binary_data);