我在 golang 中有这个结构
struct File {
name string
creatation_time time.Time
}
我如何在 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;
}
编译后检查 example.pb.go 中已创建的结构定义。
关于protobuf-3 - 如何在protobuf 3中存储时间,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42385281/