本文整理汇总了Golang中rter/data.Term.UpdateTime方法的典型用法代码示例。如果您正苦于以下问题:Golang Term.UpdateTime方法的具体用法?Golang Term.UpdateTime怎么用?Golang Term.UpdateTime使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类rter/data.Term
的用法示例。
在下文中一共展示了Term.UpdateTime方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: TestReadTerm
func TestReadTerm(t *testing.T) {
readTerm := new(data.Term)
testRead(t, "/taxonomy/"+term.Term, readTerm)
readTerm.UpdateTime = term.UpdateTime
structJSONCompare(t, term, readTerm)
}
示例2: TestSelectTerm
func TestSelectTerm(t *testing.T) {
selectedTerm := new(data.Term)
selectedTerm.Term = term.Term
t.Log(selectedTerm.Term)
err := Select(selectedTerm)
if err != nil {
t.Error(err)
}
t.Log(term.UpdateTime.UTC())
t.Log(selectedTerm.UpdateTime.UTC())
selectedTerm.UpdateTime = term.UpdateTime
structJSONCompare(t, term, selectedTerm)
}
示例3: scanTerm
func scanTerm(term *data.Term, rows *sql.Rows) error {
var updateTimeString string
cols, err := rows.Columns()
if err != nil {
return err
}
if len(cols) < 5 {
err = rows.Scan(
&term.Term,
&term.Automated,
&term.Author,
&updateTimeString,
)
} else {
err = rows.Scan(
&term.Term,
&term.Automated,
&term.Author,
&updateTimeString,
&term.Count,
)
}
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("Term scanner failed to parse time.")
return err
}
term.UpdateTime = updateTime
return nil
}