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