I'm trying to fetch multiple values using this function (from go-couchbase).
func (b *Bucket) Gets(k string, rv interface{}, caso *uint64) error {
data, _, cas, err := b.GetsRaw(k)
if err != nil {
return err
}
if caso != nil {
*caso = cas
}
return json.Unmarshal(data, rv)
}
The problem is that I don't know how to create a slice of rv, since I don't know its type in my function, and I have no idea how big it will be so I can't really access the rv
slice through indexes, right?
I want to be as general as possible, so creating a function per rv
struct isn't really optimal and the GetBulk function only returns a []byte
.
Is it even possible to do what I want in go?