server

package
v0.0.0-...-7b59e1e Latest Latest
Warning

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

Go to latest
Published: Aug 7, 2023 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Serve

func Serve(db ServerStorage, config config.Config) error

Types

type ArticleGetter

type ArticleGetter interface {
	GetArticles(context.Context, ...GetArticleOption) ([]feed.Article, error)
}

type ArticleSearchParams

type ArticleSearchParams struct {
	DateStart time.Time `form:"date_start" time_format:"2006-01-02T15:04:05Z07:00"`
	DateEnd   time.Time `form:"date_end" time_format:"2006-01-02T15:04:05Z07:00"`
	Filter    string    `form:"filter"`
	Limit     uint64    `form:"limit" binding:"gte=0"`
	Offset    uint64    `form:"offset" binding:"gte=0"`
	Tags      []string  `form:"tags[]"`
	Resources []string  `form:"-"`
}

func NewArticleSearchParams

func NewArticleSearchParams() (*ArticleSearchParams, error)

type DbPinger

type DbPinger interface {
	Ping(context.Context) error
}

type GetArticleOption

type GetArticleOption func(*ArticleSearchParams)

func WithDateEnd

func WithDateEnd(dateEnd time.Time) GetArticleOption

func WithDateStart

func WithDateStart(dateStart time.Time) GetArticleOption

func WithFilter

func WithFilter(filter string) GetArticleOption

func WithLimit

func WithLimit(limit uint64) GetArticleOption

func WithOffset

func WithOffset(offset uint64) GetArticleOption

func WithResourceNames

func WithResourceNames(names []string) GetArticleOption

type ServerStorage

type ServerStorage interface {
	DbPinger
	ArticleGetter
	StatsGetter
}

type StatsGetter

type StatsGetter interface {
	GetArticleStats(context.Context) ([]feed.ArticleStats, error)
}

type TaggedResourcesGetter

type TaggedResourcesGetter interface {
	GetResourcesWithTags([]string) ([]string, error)
}

Jump to

Keyboard shortcuts

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