Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

To import well-known types such as timestamp from google.golang.org/protobuf using Protobuf, you need to add the following line of code at the top of your protobuf file:

import "google/protobuf/timestamp.proto";

After that, you can use the timestamp type in your message definitions like this:

message MyMessage {
  google.protobuf.Timestamp created_at = 1;
}

Note that you also need to import any other well-known types that you want to use in your protobuf file. For example, if you want to use the duration type, you need to add the following line of code:

import "google/protobuf/duration.proto";