nlf / riakdown

A riak-backed leveldown interface based on abstract-leveldown
MIT License
28 stars 2 forks source link

Doesn't convert sibling's values based on content_type #3

Closed phated closed 4 years ago

phated commented 10 years ago

It seems to only convert the type when you get 1 result back, not when siblings are returned.

nlf commented 10 years ago

I'm not sure what you mean here. We shouldn't be doing any converting at all, and only returning buffers or strings depending on what levelup asks for.. Can you give me a code example of what you expect and what you're actually getting?

phated commented 10 years ago

Sorry for being unclear. I am specifying content_type as 'application/json' but the values of each sibling is a buffer. Based on the documentation, I assumed they would be objects before reaching my sibling resolver. I thought this was related to https://github.com/nlf/riakdown/blob/master/index.js#L68-L70 only handling the length of 1.

nlf commented 10 years ago

Ah, I see what you mean. No, the issue here is actually that levelup is doing the conversions for us. You can see here that we set parse_values to false which prevents riakpbc from doing any conversions. This was to make sure that levelup works correctly.

I see what you mean with the siblings though, it would be helpful to parse them for you before presenting them to the resolver as well as converting the result back to a buffer or string transparently. I'll see if I can work something out.

phated commented 10 years ago

Thanks! I ended up putting the logic in my resolver for the time being.