Closed eqinox76 closed 1 month ago
That's by design (possibly wrong design). We turn protos to binary blobs: https://github.com/google/go-cloud/blob/master/docstore/driver/codec.go#L135. Perhaps we should have used protojson.
We have no way to insert your own codec, but you could write your own driver and register it.
Ah, thanks for explaining. Serializing the messages via protojson is working fine. But having normal structs with partial protobuf messages is getting much more complex. I will have a look at implementing a kind of wrapper driver.
We might add an option to serialize protos as JSON. (We can't do it by default, to preserve backwards compatibility.) You can file an issue for that.
Describe the bug
A protobug generated struct can be
Put
andGet
from the docstore but theWhere
search is not working.To Reproduce
Minimal reproducible programm that writes one
testType
and tries to search for it. When changing the From property fromdate.Date
toDate
the search is working fine.results in:
Expected behavior
Query().Where("From.Month", "=", 12)
must return one element.Version
go version go1.23.1 linux/amd64
gocloud.dev v0.39.0 gocloud.dev/docstore/mongodocstore v0.39.0
Additional context
Doing the same with a local mongodb instance instead of the mem implementation acts the same way. In the mongodb i see the
From
property serialized as binary data which may explain this behavior: