我如何获得时间Golang protobuf v3结构中的时间

I'm using the google time package github.com/golang/protobuf/ptypes/timestamp in protobuf message file now.

google.protobuf.Timestamp UpdateTime = 9;

But the UpdateTime property becomes a pointer *timestamp.Timestamp in golang struct after protoc compiling, it's not a time.Time and i can't save these property into Mysql timestamp column.

What can i do?

To obtain a time.Time from a protobuf field of type google.protobuf.Timestamp, use the ptypes.Timestamp helper function.

When producing the insert call into your database, or any other location where a time.Time is required, call ptypes.Timestamp(myMsg.UpdateTime) to obtain the required value (where myMsg is a variable to an instance of the relevant Protobuf message type).