Import timestamp in proto file of protobuf for GRPC

Rajesh kumar picture Rajesh kumar · Jun 10, 2017 · Viewed 15.9k times · Source

I am trying to use gRPC and using the exchange message format as protobuf. I wanted to add timestamp field inside my message.But i don't know the right way to add the import statement in proto file. I am using Golang so I need an output as .pb.go

Answer

Sergeenho picture Sergeenho · Mar 4, 2018

Make sure to import in your proto file:

import "google/protobuf/timestamp.proto";

And use the type for you variable like:

google.protobuf.Timestamp time_name = 1;