Set Meta Data to badger

(vladimir) #1

Can somebody add examples?
How I can add metadata to method set to badger.
And how I can get metadata from key in db.

(Daniel Mai) #2

Does the documentation for SetWithMeta help?

As well as the docstring and implementation for SetWithMeta?

(vladimir) #3

But meta is byte. Can I add some string data to meta?
For example, I have:
key - “string” & value - map[string]string or map[int]int (with json.Marshal)
I need to add type of map to meta (map[int]string). How I can do this?
How I can get meta from key-value pair?

(Daniel Mai) #4

What you can do is set bit fields that indicate the type of the value, e.g.,

mapStringString = 0x01
mapStringInt = 0x02

and then use those for value type checking.