我在golang中有这个结构
struct File {
name string
creatation_time time.Time
}
Run Code Online (Sandbox Code Playgroud)
如何在protobuf3中编写它?
创建 example.proto;
syntax = "proto3";
import google_protobuf "github.com/golang/protobuf/ptypes/timestamp"
message File {
string name = 1;
google.protobuf.Timestamp creatation_time = 2;
}
Run Code Online (Sandbox Code Playgroud)
编译后,检查 example.pb.go 中已创建的结构定义。