usecase

package
v0.0.0-...-1cf632a Latest Latest
Warning

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

Go to latest
Published: Mar 13, 2024 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Overview

Package usecase provides business logic.

Package usecase provides business logic.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetBotUseCase

func SetBotUseCase(uc *BotUseCase)

func SetParserUseCase

func SetParserUseCase(uc *ParserUseCase)

Types

type BotUseCase

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

BotUseCase object capable of interacting with BotUseCase

func NewBotUseCase

func NewBotUseCase(ctx context.Context, cfg *entity.BotConfig, log *logger.Zerolog, db *database.Database, feedsRepo FeedsRepo,
	itemsRepo FeedItemsRepo, usersRepo UsersRepo, subscriptionsRepo SubscriptionsRepo) (*BotUseCase, error)

NewBotUseCase creates a new BotUseCase

func (*BotUseCase) Send

func (uc *BotUseCase) Send(feed *entity.Feed, items []*entity.RSSFeedItem)

func (*BotUseCase) Start

func (uc *BotUseCase) Start()

type CleanerUseCase

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

CleanerUseCase object capable of interacting with CleanerUseCase

func NewCleanerUseCase

func NewCleanerUseCase(ctx context.Context, cfg *entity.CleanerConfig, log *logger.Zerolog, feedsRepo FeedsRepo, itemsRepo FeedItemsRepo) (*CleanerUseCase, error)

NewCleanerUseCase creates a new CleanerUseCase

func (*CleanerUseCase) Start

func (uc *CleanerUseCase) Start()

type FeedItemsRepo

type FeedItemsRepo interface {
	Create(ctx context.Context, in *entity.FeedItem) (*entity.FeedItem, error)
	Delete(ctx context.Context, feedID string, toDate time.Time) error
}

FeedItemsRepo is the common interface implemented FeedItemsRepository methods

type FeedsRepo

type FeedsRepo interface {
	Get(ctx context.Context, filter *entity.FeedFilter) ([]*entity.Feed, error)
	GetForUpdate(ctx context.Context, delay int64) ([]*entity.Feed, error)
	Create(ctx context.Context, in *entity.Feed) (*entity.Feed, error)
	Update(ctx context.Context, in *entity.Feed) (*entity.Feed, error)
	Delete(ctx context.Context, id string) error
}

FeedsRepo is the common interface implemented FeedsRepository methods

type ParserUseCase

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

ParserUseCase object capable of interacting with ParserUseCase

func NewParserUseCase

func NewParserUseCase(ctx context.Context, cfg *entity.ParserConfig, log *logger.Zerolog, feedsRepo FeedsRepo) (*ParserUseCase, error)

NewParserUseCase creates a new ParserUseCase

func (*ParserUseCase) CheckFeedURL

func (uc *ParserUseCase) CheckFeedURL(ctx context.Context, uri string) (string, error)

func (*ParserUseCase) LoadFeed

func (uc *ParserUseCase) LoadFeed(feed *entity.Feed)

func (*ParserUseCase) Start

func (uc *ParserUseCase) Start()

type SubscriptionsRepo

type SubscriptionsRepo interface {
	GetByUserID(ctx context.Context, id int64) ([]*entity.Subscription, error)
	GetByFeedID(ctx context.Context, id string) ([]*entity.Subscription, error)
	Create(ctx context.Context, in *entity.Subscription) (*entity.Subscription, error)
	Delete(ctx context.Context, id string) error
}

SubscriptionsRepo is the common interface implemented SubscriptionsRepository methods

type UsersRepo

type UsersRepo interface {
	Create(ctx context.Context, in *entity.User) (*entity.User, error)
	Get(ctx context.Context, filter *entity.UsersFilter) ([]*entity.User, error)
}

UsersRepo is the common interface implemented UsersRepository methods

Jump to

Keyboard shortcuts

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