i storing c structures couchbase, doing so can read these structures later , process directly, avoiding steps of 1 )c structure - > json while storing , 2 )json -> c structure while retrieving.
this working when use lcb_get() , lcb_set() need have requirement making hits views using rest model , lcb_make_http_request () call.
so wondering how lcb_make_http_request () handle non-json c structure , hex data , may have nulls in between. still able extract , populate c - structure data http response after calling lcb_make_http_request () ?
as wiredprairie said in comment aren't forced use json , can store c structs, keep in mind byte order , field alignment when doing so.
when server detects data isn't in json format encode using base64 , set meta.type
"json"
when document comes map function.
and able emit complete document value if you'd value in http stream. in case of simple map function:
function (doc, meta) { if (meta.type == "base64") { emit(meta.id); } }
you response 1 (i've formatted clarity):
{ "total_rows": 1, "rows": [ { "id": "foo", "key": "foo", "value": "4kwuagaaaaa=" } ] }
it mean must use json parser extract "value"
attribute result, decode , same bytestream, have sent set command.
Comments
Post a Comment