querying

package
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 14, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrPageNumberOutOfBounds error = errors.New("querying: invalid page index (out of bounds)")
)

Functions

This section is empty.

Types

type FeedPage

type FeedPage struct {
	PageNumber         uint
	PreviousPageNumber uint
	NextPageNumber     uint
	TotalPages         uint
	Offset             uint

	Header     string
	Unread     uint
	Categories []SubscribedFeedsByCategory
	Entries    []SubscribedFeedEntry
}

A FeedPage holds a set of paginated Feeds.

func NewFeedPage

func NewFeedPage(number uint, totalPages uint, header string, categories []SubscribedFeedsByCategory, entries []SubscribedFeedEntry) FeedPage

type Repository

type Repository interface {
	// FeedGetByUUID returns a given feed.
	FeedGetByUUID(feedUUID string) (feed.Feed, error)

	// FeedEntryGetCount returns the count of entries corresponding to a feed subscription
	// for a giver user.
	FeedEntryGetCount(userUUID string) (uint, error)

	// FeedEntryGetCountByCategory returns the count of entries corresponding to a feed subscription
	// for a giver user and category.
	FeedEntryGetCountByCategory(userUUID string, categoryUUID string) (uint, error)

	// FeedEntryGetCountBySubscription returns the count of entries corresponding to a feed subscription
	// for a giver user and subscription.
	FeedEntryGetCountBySubscription(userUUID string, feedUUID string) (uint, error)

	// FeedSubscriptionCategoryGetAll returns SubscribedFeeds, sorted by SubscriptionCategory.
	FeedSubscriptionCategoryGetAll(userUUID string) ([]SubscribedFeedsByCategory, error)

	// FeedSubscriptionEntryGetN returns at most n SubscriptionEntries, starting at a given offset.
	FeedSubscriptionEntryGetN(userUUID string, entriesPerPage uint, offset uint) ([]SubscribedFeedEntry, error)

	// FeedSubscriptionEntryGetNByCategory returns at most n SubscriptionEntries, starting at a given offset.
	FeedSubscriptionEntryGetNByCategory(userUUID string, categoryUUID string, entriesPerPage uint, offset uint) ([]SubscribedFeedEntry, error)

	// FeedSubscriptionEntryGetNBySubscription returns at most n SubscriptionEntries, starting at a given offset.
	FeedSubscriptionEntryGetNBySubscription(userUUID string, subscriptionUUID string, entriesPerPage uint, offset uint) ([]SubscribedFeedEntry, error)

	// FeedSubscriptionTitleByUUID returns feed subscription metadata for a given user and subscription.
	FeedSubscriptionTitleByUUID(userUUID string, subscriptionUUID string) (SubscriptionTitle, error)

	// FeedSubscriptionTitlesByCategory returns a list of feed Subscription titles, sorted by Category.
	FeedSubscriptionTitlesByCategory(userUUID string) ([]SubscriptionsTitlesByCategory, error)
}

Repository provides access to user feed subscriptions for querying.

type Service

type Service struct {
	// contains filtered or unexported fields
}

Service handles oprtaions related to displaying and paginating feeds.

func NewService

func NewService(r Repository) *Service

NewService initializes and returns a new Service.

func (*Service) FeedsByCategoryAndPage

func (s *Service) FeedsByCategoryAndPage(userUUID string, category feed.Category, number uint) (FeedPage, error)

FeedsByCategoryAndPage returns a Page containing a limited and offset number of feeds.

func (*Service) FeedsByPage

func (s *Service) FeedsByPage(userUUID string, number uint) (FeedPage, error)

FeedsByPage returns a Page containing a limited and offset number of feeds.

func (*Service) FeedsBySubscriptionAndPage

func (s *Service) FeedsBySubscriptionAndPage(userUUID string, subscription feed.Subscription, number uint) (FeedPage, error)

FeedsBySubscriptionAndPage returns a Page containing a limited and offset number of feeds.

func (*Service) SubscriptionTitleByUUID

func (s *Service) SubscriptionTitleByUUID(userUUID string, subscriptionUUID string) (SubscriptionTitle, error)

func (*Service) SubscriptionTitlesByCategory

func (s *Service) SubscriptionTitlesByCategory(userUUID string) ([]SubscriptionsTitlesByCategory, error)

type SubscribedFeed

type SubscribedFeed struct {
	feed.Feed

	Unread uint
}

type SubscribedFeedEntry

type SubscribedFeedEntry struct {
	feed.Entry

	Read bool
}

type SubscribedFeedsByCategory

type SubscribedFeedsByCategory struct {
	feed.Category

	Unread uint

	SubscribedFeeds []SubscribedFeed
}

type SubscriptionTitle

type SubscriptionTitle struct {
	SubscriptionUUID string
	FeedTitle        string
}

type SubscriptionsTitlesByCategory

type SubscriptionsTitlesByCategory struct {
	feed.Category

	SubscriptionTitles []SubscriptionTitle
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL