I’m using elixir-grpc to write a client for my Bloomberg API gRPC implementation. This is working quite well in Python, and I now want to bring the Bloomberg API to Elixir. Naturally timestamps are going to be necessary, but I don’t know how to use them in Elixir.
Elixir-grpc says it uses the protobuf library which in turn says that “since :protobuf
version 0.14.0
we include all of the well known Google Protobuf modules” (which is strange since their latest release is 0.13.0
).
Anyway I’m getting errors with Google.Protobuf.Timestamp
. Here is my proto file that uses timestamps, and this successfully compiles to elixir code using protoc --elixir_out=plugins=grpc:../lib *.proto
. You can see the output here, but when I try to do a simple ping/pong to the server, there’s a massive error which mentions that Google.Protobuf.Timestamp is not available:
So in Python I would bring Google.Protobuf.Timestamp (and Struct
and Empty
) in like this:
from google.protobuf.struct_pb2 import Struct
from google.protobuf.timestamp_pb2 import Timestamp as protoTimestamp
from google.protobuf import empty_pb2
and then I could use them, but I don’t know how to do this in Elixir. Should I be generating my own code from the canonical Google.Protobuf.Timestamp proto files? This seems strange as I would think either elixir-grpc
or protobuf
would have done that already.