1
我有这样的结构在golang如何存储时间protobuf的3
struct File {
name string
creatation_time time.Time
}
我怎样写它protobuf3?
我有这样的结构在golang如何存储时间protobuf的3
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。
您使用的是哪个版本的protoc?我是libprotoc 3.0.0,我必须导入“github.com/golang/protobuf/ptypes/timestamp/timestamp.proto”,它也给我* google_protobuf.Timestamp不是golang的标准时间。 – thanhpk