querying

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Dec 7, 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

	SearchTerms       string
	SearchResultCount uint

	Header      string
	Description 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, description string, categories []SubscribedFeedsByCategory, entries []SubscribedFeedEntry) FeedPage

NewFeedPage initializes and returns a new FeedPage.

func NewFeedSearchResultPage added in v0.3.0

func NewFeedSearchResultPage(searchTerms string, searchResultCount uint, number uint, totalPages uint, header string, description string, categories []SubscribedFeedsByCategory, entries []SubscribedFeedEntry) FeedPage

NewFeedSearchResultPage initializes and returns a new FeedPage containing search results.

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, subscriptionUUID string) (uint, error)

	// FeedEntryGetCount returns the count of entries corresponding to a feed subscription
	// for a giver user, and matching a search query.
	FeedEntryGetCountByQuery(userUUID string, searchTerms string) (uint, error)

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

	// FeedEntryGetCountBySubscriptionAndQuery returns the count of entries corresponding to a feed subscription
	// for a giver user and subscription, and matching a search query.
	FeedEntryGetCountBySubscriptionAndQuery(userUUID string, subscriptionUUID string, query 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)

	// FeedSubscriptionEntryGetNByQuery returns at most n SubscriptionEntries matching a search query, starting at a given offset.
	FeedSubscriptionEntryGetNByQuery(userUUID string, searchTerms string, entriesPerPage uint, offset uint) ([]SubscribedFeedEntry, error)

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

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

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

	// FeedQueryingSubscriptionsByCategory returns a list of feed Subscription titles, sorted by Category.
	FeedQueryingSubscriptionsByCategory(userUUID string) ([]SubscriptionsByCategory, 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) FeedsByCategoryAndQueryAndPage added in v0.3.0

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

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) FeedsByQueryAndPage added in v0.3.0

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

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) FeedsBySubscriptionAndQueryAndPage added in v0.3.0

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

func (*Service) SubscriptionByUUID added in v0.3.1

func (s *Service) SubscriptionByUUID(userUUID string, subscriptionUUID string) (Subscription, error)

func (*Service) SubscriptionsByCategory added in v0.3.1

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

type SubscribedFeed

type SubscribedFeed struct {
	feed.Feed

	Alias  string
	Unread uint
}

type SubscribedFeedEntry

type SubscribedFeedEntry struct {
	feed.Entry

	FeedTitle string
	Read      bool
}

type SubscribedFeedsByCategory

type SubscribedFeedsByCategory struct {
	feed.Category

	Unread uint

	SubscribedFeeds []SubscribedFeed
}

type Subscription added in v0.3.0

type Subscription struct {
	UUID         string
	CategoryUUID string
	Alias        string

	FeedTitle       string
	FeedDescription string
}

type SubscriptionsByCategory added in v0.3.0

type SubscriptionsByCategory struct {
	feed.Category

	Subscriptions []Subscription
}

Jump to

Keyboard shortcuts

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