I'm using Google's datastore in my Go app. I have a Song
struct, which has a uuid.UUID
field.
type Song struct {
ID: uuid.UUID
Title: string
...
}
This UUID
is taken from github.com/satori/go.uuid and is defined as
type UUID [16]byte
It seems that datastore can't handle byte arrays but in this use case only byte slices or strings. In the json
package I can use a tag to interpret it as a string
type Song struct {
ID: uuid.UUID `json:"id,string"`
....
}
Is there a way of telling datastore to interpret the UUID
as a slice/string or do I either have to give up "type"-safety and just store a string or use a custom PropertyLoadSaver
?