go-timestamp-sql
从null.Time转换为Google Protobuf时间戳的功能,反之亦然。
这非常有用,因为我们使用库将时间戳字段存储到SQL中。
入门
go get -v github.com/AlpacaLabs/go-timestamp-sql
并在您的Go代码中
import (
"testing"
"time"
clock "github.com/AlpacaLabs/go-timestamp"
. "github.com/smartystreets/goconvey/convey"
)
func Test_TimestampConversion ( t * testing. T ) {
Convey ( "Given some non-zero time" , t , func ( c C ) {
now := time . Now
1