我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 關注
- 179 瀏覽
添加回答
舉報
0/150
提交
取消