本文整理匯總了Golang中github.com/urandom/readeef/content.User.Tags方法的典型用法代碼示例。如果您正苦於以下問題:Golang User.Tags方法的具體用法?Golang User.Tags怎麽用?Golang User.Tags使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/urandom/readeef/content.User
的用法示例。
在下文中一共展示了User.Tags方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: getGroups
func getGroups(user content.User) (g []feverGroup, fg []feverFeedsGroup, err error) {
tags := user.Tags()
if user.HasErr() {
err = fmt.Errorf("Error getting user tags: %v", user.Err())
return
}
g = make([]feverGroup, len(tags))
fg = make([]feverFeedsGroup, len(tags))
for i := range tags {
td := tags[i].Data()
g[i] = feverGroup{Id: int64(td.Id), Title: string(td.Value)}
feeds := tags[i].AllFeeds()
if tags[i].HasErr() {
err = fmt.Errorf("Error getting tag feeds: %v", tags[i].Err())
return
}
ids := make([]string, len(feeds))
for j := range feeds {
ids[j] = strconv.FormatInt(int64(feeds[j].Data().Id), 10)
}
fg[i] = feverFeedsGroup{GroupId: int64(td.Id), FeedIds: strings.Join(ids, ",")}
}
return
}
示例2: Handler
//.........這裏部分代碼省略.........
feeds := user.AllFeeds()
cContent = append(cContent,
ttRssCounter{Id: "subscribed-feeds", Counter: int64(len(feeds))})
cContent = append(cContent, ttRssCounter{Id: TTRSS_ARCHIVED_ID})
cContent = append(cContent,
ttRssCounter{Id: TTRSS_FAVORITE_ID,
Counter: user.Count(data.ArticleCountOptions{UnreadOnly: true, FavoriteOnly: true}),
AuxCounter: user.Count(data.ArticleCountOptions{FavoriteOnly: true})})
cContent = append(cContent, ttRssCounter{Id: TTRSS_PUBLISHED_ID})
freshTime := time.Now().Add(TTRSS_FRESH_DURATION)
cContent = append(cContent,
ttRssCounter{Id: TTRSS_FRESH_ID,
Counter: user.Count(data.ArticleCountOptions{UnreadOnly: true, AfterDate: freshTime}),
AuxCounter: 0})
cContent = append(cContent,
ttRssCounter{Id: TTRSS_ALL_ID,
Counter: user.Count(),
AuxCounter: 0})
for _, f := range feeds {
cContent = append(cContent,
ttRssCounter{Id: int64(f.Data().Id), Counter: f.Count(o)},
)
}
cContent = append(cContent, ttRssCounter{Id: TTRSS_CAT_LABELS, Counter: 0, Kind: "cat"})
for _, t := range user.Tags() {
cContent = append(cContent,
ttRssCounter{
Id: int64(t.Data().Id),
Counter: t.Count(o),
Kind: "cat",
},
)
}
cContent = append(cContent,
ttRssCounter{
Id: TTRSS_CAT_UNCATEGORIZED,
Counter: user.Count(data.ArticleCountOptions{UnreadOnly: true, UntaggedOnly: true}),
Kind: "cat",
},
)
if user.HasErr() {
err = fmt.Errorf("Error getting user counters: %v\n", user.Err())
}
con = cContent
case "getFeeds":
fContent := ttRssFeedsContent{}
if req.CatId == TTRSS_CAT_ALL || req.CatId == TTRSS_CAT_SPECIAL {
unreadFav := user.Count(data.ArticleCountOptions{UnreadOnly: true, FavoriteOnly: true})
if unreadFav > 0 || !req.UnreadOnly {
fContent = append(fContent, ttRssFeed{
Id: TTRSS_FAVORITE_ID,
Title: ttRssSpecialTitle(TTRSS_FAVORITE_ID),