finder

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

This package contains read-only queries that require more data than just the normalized domain models (like articles or blogs+isFollowing). They are not grouped by types and instead exist as top-level methods of the Finder struct.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Article

type Article struct {
	Title       string    `db:"title"`
	URL         string    `db:"url"`
	BlogTitle   string    `db:"blog_title"`
	BlogURL     string    `db:"blog_url"`
	PublishedAt time.Time `db:"published_at"`
	Tags        []string  `db:"tags"`
}

type BlogForAccount

type BlogForAccount struct {
	ID          uuid.UUID `db:"id"`
	Title       string    `db:"title"`
	SiteURL     string    `db:"site_url"`
	IsFollowing bool      `db:"is_following"`
}

type Finder

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

func New

func New(conn postgres.Conn) *Finder

func (*Finder) CountArticles

func (f *Finder) CountArticles() (int, error)

func (*Finder) CountArticlesByAccount

func (f *Finder) CountArticlesByAccount(account *model.Account) (int, error)

func (*Finder) CountSearchArticles

func (f *Finder) CountSearchArticles(search string) (int, error)

func (*Finder) CountSearchArticlesByAccount

func (f *Finder) CountSearchArticlesByAccount(account *model.Account, search string) (int, error)

func (*Finder) ListArticles

func (f *Finder) ListArticles(limit, offset int) ([]Article, error)

func (*Finder) ListArticlesByAccount

func (f *Finder) ListArticlesByAccount(account *model.Account, limit, offset int) ([]Article, error)

func (*Finder) ListBlogsForAccount

func (f *Finder) ListBlogsForAccount(account *model.Account) ([]BlogForAccount, error)

TODO: Paginate this.

func (*Finder) SearchArticles

func (f *Finder) SearchArticles(search string, limit, offset int) ([]Article, error)

func (*Finder) SearchArticlesByAccount

func (f *Finder) SearchArticlesByAccount(account *model.Account, search string, limit, offset int) ([]Article, error)

Jump to

Keyboard shortcuts

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