我Quote在 Go 中有一个结构type Quote struct{ CreatedAt int64 `gorethink:"createdAt"` // Other fields...}我写信从 RethinkDB 查询数据并成功result,err:=r.Table("quote").GetAll(ids...).Run(session)defer result.Close() if err!=nil{ fmt.Println(err) } var quotes []Quote err=result.All("es)它确实得到了真实的结果,但没有任何记录在CreatedAt字段中具有价值。我createdAt在数据库中使用的时间格式是自 UTC 纪元以来的毫秒数,我打算将它们用作数字来计算我阅读了 GoDocs 并发现:func (t Time) Unix() int64所以我认为int64这是正确的类型CreatedAt,但它没有用。我该怎么办?如何获取时间数据?time.Time也不行。如果time.Time使用,则结果始终为0001-01-01 00:00:00 +0000 UTC(0如果转换为毫秒,则为类似值)因为当我在 NodeJS 中构建我使用的相同服务器时Date.Now(),在这种情况下我需要寻找一个等效类型,它返回一个数字供我计算后面的过程
- 2 回答
- 0 关注
- 238 浏览
添加回答
举报
0/150
提交
取消
