本文整理汇总了Golang中rter/data.UserDirection.UpdateTime方法的典型用法代码示例。如果您正苦于以下问题:Golang UserDirection.UpdateTime方法的具体用法?Golang UserDirection.UpdateTime怎么用?Golang UserDirection.UpdateTime使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类rter/data.UserDirection
的用法示例。
在下文中一共展示了UserDirection.UpdateTime方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: scanUserDirection
func scanUserDirection(direction *data.UserDirection, rows *sql.Rows) error {
var updateTimeString string
err := rows.Scan(
&direction.Username,
&direction.LockUsername,
&direction.Command,
&direction.Heading,
&direction.Lat,
&direction.Lng,
&updateTimeString,
)
if err != nil {
return err
}
updateTime, err := time.Parse("2006-01-02 15:04:05", updateTimeString) // this assumes UTC as timezone
if err != nil {
log.Println("UserDirection scanner failed to parse time.")
return err
}
direction.UpdateTime = updateTime
return nil
}
示例2: TestReadUserDirection
func TestReadUserDirection(t *testing.T) {
readDirection := new(data.UserDirection)
testRead(t, "/users/"+user.Username+"/direction", readDirection)
readDirection.UpdateTime = direction.UpdateTime // hack
structJSONCompare(t, direction, readDirection)
}
示例3: TestSelectUserDirection
func TestSelectUserDirection(t *testing.T) {
selectedDirection := new(data.UserDirection)
selectedDirection.Username = user.Username
err := Select(selectedDirection)
if err != nil {
t.Error(err)
}
t.Log(selectedDirection.UpdateTime.UTC())
t.Log(direction.UpdateTime.UTC())
selectedDirection.UpdateTime = direction.UpdateTime // hack
structJSONCompare(t, direction, selectedDirection)
}