Golang:如何将 time.Time 转换为 Protobuf 时间戳?

Fes*_*235 17 timestamp go protocol-buffers unix-timestamp

我在 Golang 中有一个 time.Time 变量10-30 00:49:07.1236,需要转换为 Go Protobuf timestamp.Timestamp。知道可以使用哪些函数来完成此任务吗?或者我从错误的角度看待这个问题?

Daz*_*kin 23

查看NewTimestamp.AsTime进入timestamppb

这些支持与和之间的time.Time转换Timestamp