mock

package
v0.2.4 Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package mock provides hand-written mocks of the root service interfaces for testing, in the WTF style: a struct of function fields, each method delegating to its field.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FeedService

type FeedService struct {
	FindFeedsFn     func(ctx context.Context, filter firehose.FeedFilter) ([]*firehose.Feed, int, error)
	FindFeedByURLFn func(ctx context.Context, url string) (*firehose.Feed, error)
	SyncFeedsFn     func(ctx context.Context, feeds []*firehose.Feed) error
	UpdateFeedFn    func(ctx context.Context, id int64, upd firehose.FeedUpdate) (*firehose.Feed, error)
}

FeedService is a mock firehose.FeedService.

func (*FeedService) FindFeedByURL

func (s *FeedService) FindFeedByURL(ctx context.Context, url string) (*firehose.Feed, error)

func (*FeedService) FindFeeds

func (s *FeedService) FindFeeds(ctx context.Context, filter firehose.FeedFilter) ([]*firehose.Feed, int, error)

func (*FeedService) SyncFeeds

func (s *FeedService) SyncFeeds(ctx context.Context, feeds []*firehose.Feed) error

func (*FeedService) UpdateFeed

func (s *FeedService) UpdateFeed(ctx context.Context, id int64, upd firehose.FeedUpdate) (*firehose.Feed, error)

type ItemService

type ItemService struct {
	FindItemsFn    func(ctx context.Context, filter firehose.ItemFilter) ([]*firehose.Item, int, error)
	ItemStatsFn    func(ctx context.Context) ([]firehose.ItemStat, error)
	UpsertItemsFn  func(ctx context.Context, items []*firehose.Item) error
	PurgeExpiredFn func(ctx context.Context, olderThan time.Time) (int, error)
}

ItemService is a mock firehose.ItemService.

func (*ItemService) FindItems

func (s *ItemService) FindItems(ctx context.Context, filter firehose.ItemFilter) ([]*firehose.Item, int, error)

func (*ItemService) ItemStats added in v0.2.0

func (s *ItemService) ItemStats(ctx context.Context) ([]firehose.ItemStat, error)

func (*ItemService) PurgeExpired

func (s *ItemService) PurgeExpired(ctx context.Context, olderThan time.Time) (int, error)

func (*ItemService) UpsertItems

func (s *ItemService) UpsertItems(ctx context.Context, items []*firehose.Item) error

Jump to

Keyboard shortcuts

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