-
Notifications
You must be signed in to change notification settings - Fork 78
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Store Protobuf messages in ArangoDB #303
Comments
AFAICT, technically AQL uses velocypack, and while the API can be configured for velocypack, there's a hard-coded override in the code. A workaround to an interim marshaling step could be to wrap the PBs with a type that has a custom MarshalJSON interface in cases where timestamps and durations are listed. Part of this is that PBs timestamp/durations are... novel. But I could see protojson added as an encoding option to both AQL and API. I haven't looked deeply at the code, but this could be complicated in the AQL case if a need would arise to mix the marshaling of different bindvars, for example. This might be a good v2 feature if Team Arango would be willing to take the contribution? |
Right now, we can't do this. The default for the server is to receive and send JSON data. Many drivers do not implement velocypack and are thus relying on the JSON APIs. |
I would like to be able to store Protobuf Go structs directly in ArangoDB.
The problem is that the standard "encoding/json" marshall/unmarshall doesn't work correctly on all Protobuf messages.
For example timestamps are not correctly encoded/decoded.
The protobuf project provides their own JSON marshaller in "google.golang.org/protobuf/encoding/protojson".
Unfortunately the ArangoDB go-driver only supports "encoding/json".
I see two options to solve this problem:
Probably not ideal as this significantly increases the API interface.
Do you see any other ways to solve this problem ?
I would be willing to help with the implementation.
Many databases don't work well with Protobuf messages due to similar issues and because ArangoDB already uses JSON as their internal data format , it could be an unique selling point for ArangoDB that Protobuf messages can be stored directly (without copying data from the Protobuf struct to a regular Go struct in order to store it in a database )..
The text was updated successfully, but these errors were encountered: