The Subspace.Unpack method takes a key in that subspace and returns the tuple parsed value from that key’s suffix, which I think is what you want.
So if you’re subspace is defined by the prefix \x02my_subspace\x00 and you have a tuple value (like, say, (string, 100)), then that’ll get packed into a single FDBKey that looks like \x02my_subspace\x00\x02string\x00\x15\x64, and then calling Subspace.Unpack(key) will return (string, 100) as a Tuple (and a nil error).
Indeed, that returns (2, 3). This will resolve my issue, thanks!
However, splitting (2, 3) is still difficult because we don’t actually know that what is the child element value. So an API to split subspaces is needed. Can you provide that API?
I’m also not an expert at go, but I think the Tuple type is itself a slice (of TupleElements), so I think you should be able to do most of the things that you would have wanted to do if you could convert it to a []interface{} (via some .Array() method).
I couldn’t find the greatest of examples of this in our recipes, but there is this here: foundationdb/table.go at 55b8ff58168c9664f31b19e8f88e2e171fe5d8fe · apple/foundationdb · GitHub You can see that this calls Unpack on a []byte to create a Tuple, and then it asks the tuple for element 0 and returns the interface{} that it found there. But I think you should be able to call all of the functions you’d expect to exist on slices on Tuples as well.