I have this struct in golang
struct File {
name string
creatation_time time.Time
}
How do I write it in protobuf3 ?
Reference documentation and code samples for the Kubernetes Engine V1 API class Google::Protobuf::Timestamp. A Timestamp represents a point in time independent of any time zone or local calendar, encoded as a count of seconds and fractions of seconds at nanosecond resolution.
It can accept input crafted by later versions of protobuf. The sender is backward compatible because it's creating output that can be consumed by earlier versions. So long as you're careful about when and how you change and remove fields, your protobuf will be forward and backward compatible.
Protobuf messages are either present (possibly default) valued or optional but they can't be null.
For bool s, the default value is false. For numeric types, the default value is zero. For enums , the default value is the first value listed in the enum's type definition. This means care must be taken when adding a value to the beginning of an enum value list.
Create example.proto;
syntax = "proto3";
import google_protobuf "github.com/golang/protobuf/ptypes/timestamp"
message File {
string name = 1;
google.protobuf.Timestamp creatation_time = 2;
}
After compilation check the example.pb.go for the structure definition that has been created.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With