Documentation ¶
Index ¶
- Constants
- func ContentTypesToContentIds(contentTypes []string) []string
- func SplitContentItems(contentItems []ContentItem, numLists int) [][]ContentItem
- type CollectionSuggester
- type ContentItem
- type ContentUnitsSuggester
- type Feed
- type MoreOptions
- type MoreRequest
- type Recommend
- type RoundRobinSuggester
- type SortSuggester
- type Subscriptions
- type Suggester
Constants ¶
View Source
const ( SUBSCRIBE = "subscribe" UNSUBSCRIBE = "unsubscribe" DEFAULT = "default" )
Variables ¶
This section is empty.
Functions ¶
func SplitContentItems ¶
func SplitContentItems(contentItems []ContentItem, numLists int) [][]ContentItem
Types ¶
type CollectionSuggester ¶
type CollectionSuggester struct {
// contains filtered or unexported fields
}
func MakeCollectionSuggester ¶
func MakeCollectionSuggester(db *sql.DB, contentType string) *CollectionSuggester
func (*CollectionSuggester) More ¶
func (suggester *CollectionSuggester) More(request MoreRequest) ([]ContentItem, error)
type ContentItem ¶
type ContentItem struct { UID string `json:"uid"` ContentType string `json:"content_type"` Date time.Time `json:"date"` CreatedAt time.Time `json:"created_at"` OriginalOrder []int64 `json:"original_order"` Suggester string `json:"suggester"` }
func Merge ¶
func Merge(r MoreRequest, suggestions [][]ContentItem) ([]ContentItem, error)
func Unsort ¶
func Unsort(contentItems []ContentItem) []ContentItem
type ContentUnitsSuggester ¶
type ContentUnitsSuggester struct {
// contains filtered or unexported fields
}
func MakeContentUnitsSuggester ¶
func MakeContentUnitsSuggester(db *sql.DB, contentTypes []string) *ContentUnitsSuggester
func (*ContentUnitsSuggester) More ¶
func (suggester *ContentUnitsSuggester) More(request MoreRequest) ([]ContentItem, error)
type Feed ¶
type Feed struct {
Suggesters []Suggester
}
func (*Feed) More ¶
func (f *Feed) More(r MoreRequest) ([]ContentItem, error)
type MoreOptions ¶
type MoreOptions struct { ContentTypes Subscriptions `json:"content_types" form:"content_type"` // Map from collection content type to Subscriptions. Collections map[string]Subscriptions `json:"collections" form:"collections"` Recommend Recommend `json:"recommend" form:"recommend"` }
type MoreRequest ¶
type MoreRequest struct { CurrentFeed []ContentItem `json:"current_feed" form:"current_feed"` MoreItems int `json:"more_items" form:"more_items"` Options MoreOptions `json:"options" form:"options"` }
type RoundRobinSuggester ¶
type RoundRobinSuggester struct {
// contains filtered or unexported fields
}
func MakeRoundRobinSuggester ¶
func MakeRoundRobinSuggester(suggesters []Suggester) *RoundRobinSuggester
func (*RoundRobinSuggester) More ¶
func (suggester *RoundRobinSuggester) More(request MoreRequest) ([]ContentItem, error)
type SortSuggester ¶
type SortSuggester struct {
// contains filtered or unexported fields
}
Sort items by date and then by create at time.
func MakeSortSuggester ¶
func MakeSortSuggester(suggester Suggester) *SortSuggester
func (*SortSuggester) More ¶
func (suggester *SortSuggester) More(request MoreRequest) ([]ContentItem, error)
type Subscriptions ¶
Keys are content types or collection mids. Values are one of the constants: SUBSCRIBE, UNSUBSCRIBE, DEFAULT
type Suggester ¶
type Suggester interface {
More(request MoreRequest) ([]ContentItem, error)
}
Click to show internal directories.
Click to hide internal directories.