Documentation ¶
Index ¶
- Variables
- type BookmarkPage
- type Owner
- type Repository
- type Service
- func (s *Service) BookmarksByPage(ownerUUID string, visibility Visibility, number uint) (BookmarkPage, error)
- func (s *Service) BookmarksBySearchQueryAndPage(ownerUUID string, visibility Visibility, searchTerms string, number uint) (BookmarkPage, error)
- func (s *Service) PublicBookmarkByUID(ownerUUID string, uid string) (BookmarkPage, error)
- func (s *Service) PublicBookmarksByPage(ownerUUID string, number uint) (BookmarkPage, error)
- func (s *Service) PublicBookmarksBySearchQueryAndPage(ownerUUID string, searchTerms string, number uint) (BookmarkPage, error)
- func (s *Service) TagNamesByCount(userUUID string, visibility Visibility) ([]string, error)
- func (s *Service) Tags(userUUID string, visibility Visibility) ([]Tag, error)
- func (s *Service) TagsByFilterQueryAndPage(ownerUUID string, visibility Visibility, filterTerm string, number uint) (TagPage, error)
- func (s *Service) TagsByPage(ownerUUID string, visibility Visibility, number uint) (TagPage, error)
- type Tag
- type TagPage
- type Visibility
Constants ¶
This section is empty.
Variables ¶
Functions ¶
This section is empty.
Types ¶
type BookmarkPage ¶
type BookmarkPage struct { // Owner exposes public metadata for the User owning the bookmarks. Owner Owner PageNumber uint PreviousPageNumber uint NextPageNumber uint TotalPages uint Offset uint SearchTerms string SearchResultCount uint Bookmarks []bookmark.Bookmark }
A BookmarkPage holds a set of paginated bookmarks.
func NewBookmarkPage ¶
func NewBookmarkPage(owner Owner, number uint, totalPages uint, bookmarks []bookmark.Bookmark) BookmarkPage
NewBookmarkPage initializes and returns a new BookmarkPage.
func NewBookmarkSearchResultPage ¶
func NewBookmarkSearchResultPage(owner Owner, searchTerms string, searchResultCount uint, number uint, totalPages uint, bookmarks []bookmark.Bookmark) BookmarkPage
NewBookmarkSearchResultPage initializes and returns a new BookmarkPage containing search results.
type Owner ¶
type Owner struct { // UUID is the internal identifier for this User. UUID string // NickName is the handle used in user-specific URLs, and may only contain // alphanumerical characters, the dash character, or the underscore character. NickName string // DisplayName is the handle used in the Web interface for this User. DisplayName string }
Owner exposes public metadata for the User owning the displayed bookmarks.
type Repository ¶
type Repository interface { // BookmarkGetCount returns the number of bookmarks for a given user. BookmarkGetCount(userUUID string, visibility Visibility) (uint, error) // BookmarkGetN returns at most n bookmarks for a given user, starting at // a given offset. BookmarkGetN(userUUID string, visibility Visibility, n uint, offset uint) ([]bookmark.Bookmark, error) // BookmarkGetPublicByUID returns the bookmark for a given user and UID, provided the bookmark is public. BookmarkGetPublicByUID(userUUID, uid string) (bookmark.Bookmark, error) // BookmarkSearchCount returns the number of bookmarks for a given user and // search terms. BookmarkSearchCount(userUUID string, visibility Visibility, searchTerms string) (uint, error) // BookmarkSearchN returns at most n bookmarks for a given user and search // terms, starting at a given offset. BookmarkSearchN(userUUID string, visibility Visibility, searchTerms string, n uint, offset uint) ([]bookmark.Bookmark, error) // OwnerGetByUUID returns the Owner corresponding to a given UUID. OwnerGetByUUID(string) (Owner, error) // BookmarkTagGetAll returns all tags for a given user. BookmarkTagGetAll(userUUID string, visibility Visibility) ([]Tag, error) // BookmarkTagGetCount returns the number of tags for a given user. BookmarkTagGetCount(userUUID string, visibility Visibility) (uint, error) // BookmarkTagGetN returns at most n tags for a given user, starting at // a given offset. BookmarkTagGetN(userUUID string, visibility Visibility, n uint, offset uint) ([]Tag, error) // BookmarkTagFilterCount returns the number of tags for a given user and // filter term. BookmarkTagFilterCount(userUUID string, visibility Visibility, filterTerm string) (uint, error) // BookmarkSearchN returns at most n tags for a given user and filter // term, starting at a given offset. BookmarkTagFilterN(userUUID string, visibility Visibility, filterTerm string, n uint, offset uint) ([]Tag, error) }
Repository provides access to query user bookmarks.
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service handles operations related to displaying and paginating bookmarks.
func NewService ¶
func NewService(r Repository) *Service
NewService initializes and returns a new Service.
func (*Service) BookmarksByPage ¶
func (s *Service) BookmarksByPage(ownerUUID string, visibility Visibility, number uint) (BookmarkPage, error)
BookmarksByPage returns a Page containing a limited and offset number of bookmarks.
func (*Service) BookmarksBySearchQueryAndPage ¶
func (s *Service) BookmarksBySearchQueryAndPage(ownerUUID string, visibility Visibility, searchTerms string, number uint) (BookmarkPage, error)
BookmarksBySearchQueryAndPage returns a SearchPage containing a limited and offset number of bookmarks for a given set of search terms.
func (*Service) PublicBookmarkByUID ¶
func (s *Service) PublicBookmarkByUID(ownerUUID string, uid string) (BookmarkPage, error)
BookmarkByUID returns a Page containing a single bookmark.
func (*Service) PublicBookmarksByPage ¶
func (s *Service) PublicBookmarksByPage(ownerUUID string, number uint) (BookmarkPage, error)
PublicBookmarksByPage returns a Page containing a limited and offset number of bookmarks.
func (*Service) PublicBookmarksBySearchQueryAndPage ¶
func (s *Service) PublicBookmarksBySearchQueryAndPage(ownerUUID string, searchTerms string, number uint) (BookmarkPage, error)
PublicBookmarksBySearchQueryAndPage returns a SearchPage containing a limited and offset number of bookmarks for a given set of search terms.
func (*Service) TagNamesByCount ¶
func (s *Service) TagNamesByCount(userUUID string, visibility Visibility) ([]string, error)
TagNamesByCount returns all tag names for a given user, sorted by count in descending order.
func (*Service) Tags ¶
func (s *Service) Tags(userUUID string, visibility Visibility) ([]Tag, error)
Tags return all tags for a given user.
func (*Service) TagsByFilterQueryAndPage ¶
func (s *Service) TagsByFilterQueryAndPage(ownerUUID string, visibility Visibility, filterTerm string, number uint) (TagPage, error)
TagsByFilterQueryAndPage returns a TagSearchPage containing a limited and offset number of tags for a given filter term.
func (*Service) TagsByPage ¶
TagsByPage returns a Page containing a limited and offset number of tags.
type TagPage ¶
type TagPage struct { // Owner exposes public metadata for the User owning the bookmarks. Owner Owner PageNumber uint PreviousPageNumber uint NextPageNumber uint TotalPages uint Offset uint FilterTerm string TagCount uint Tags []Tag }
A TagPage holds a set of paginated bookmark tags.
type Visibility ¶
type Visibility string
Visibility represents a visibility filter for bookmarks.
const ( // Public and private bookmarks. VisibilityAll Visibility = "all" // Private bookmarks only. VisibilityPrivate Visibility = "private" // Public bookmarks only. VisibilityPublic Visibility = "public" )