本文整理匯總了Golang中github.com/urandom/readeef/content.User.ReadBefore方法的典型用法代碼示例。如果您正苦於以下問題:Golang User.ReadBefore方法的具體用法?Golang User.ReadBefore怎麽用?Golang User.ReadBefore使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/urandom/readeef/content.User
的用法示例。
在下文中一共展示了User.ReadBefore方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: markFeedAsRead
func markFeedAsRead(user content.User, id string, timestamp int64) (resp responseError) {
resp = newResponse()
t := time.Unix(timestamp/1000, 0)
switch {
case id == "all":
if user.ReadBefore(t, true); user.HasErr() {
resp.err = user.Err()
return
}
case id == "favorite" || strings.HasPrefix(id, "popular:"):
// Favorites are assumbed to have been read already
case strings.HasPrefix(id, "tag:"):
tag := user.Repo().Tag(user)
tag.Value(data.TagValue(id[4:]))
if tag.ReadBefore(t, true); tag.HasErr() {
resp.err = tag.Err()
return
}
default:
var feedId int64
if feedId, resp.err = strconv.ParseInt(id, 10, 64); resp.err != nil {
/* TODO: non-fatal error */
return
}
feed := user.FeedById(data.FeedId(feedId))
if feed.ReadBefore(t, true); feed.HasErr() {
resp.err = feed.Err()
return
}
}
resp.val["Success"] = true
return
}