You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
My goal was to override encode and decode in order to allow special processing for specific buckets.
A real world example would be something like:
decode = (data) ->
json = JSON.parse data
json.id = @key
json
encode = (data) ->
delete data.id
JSON.stringify data
Unfortunately I currently can not provide custom Meta objects currently as they are passed to the Meta constructor anyway. What I do at the moment looks like:
Meta = require 'riak-js/lib/meta'
Meta::encode = (data) ->
super unless @bucket == 'foo'
# do something
A nice way to do that would be:
class FooMeta extends Meta
decode = (data) ->
# ...
meta = new FooMeta()
db.save 'foo', {hello: 'world'}, meta, (err, res) ->
# hi
What do you think? :)
The text was updated successfully, but these errors were encountered:
Hey,
My goal was to override
encode
anddecode
in order to allow special processing for specific buckets.A real world example would be something like:
Unfortunately I currently can not provide custom Meta objects currently as they are passed to the Meta constructor anyway. What I do at the moment looks like:
A nice way to do that would be:
What do you think? :)
The text was updated successfully, but these errors were encountered: