usecase

package
v0.0.0-...-44fde62 Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2021 License: BSD-3-Clause Imports: 6 Imported by: 0

Documentation

Overview

Package usecase defines the business logic of the requirement. The general flow of the requirements are explicitly stated in the code.

Index

Constants

View Source
const (
	// DefaultNumberOfProject set to be 10 because it is not too many, not too few.
	DefaultNumberOfProject = 10
	// TimeUTCPlus7 derived from UTC+7 (Asia/Jakarta).
	TimeUTCPlus7 = 7 * time.Hour
)

Variables

This section is empty.

Functions

This section is empty.

Types

type TaniFundProjectChecker

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

TaniFundProjectChecker is responsible to check whether there is worthy new project to fund. If there is worthy new project to fund, it notifies the user.

func NewTaniFundProjectChecker

func NewTaniFundProjectChecker(projectGetter TaniFundProjectGetter, notifier TaniFundProjectNotifier, recipientID int) *TaniFundProjectChecker

NewTaniFundProjectChecker creates an instance of TaniFundProjectChecker. By default, the number of project to be retrieved is DefaultNumberOfProject.

func (*TaniFundProjectChecker) CheckAndNotify

func (tpc *TaniFundProjectChecker) CheckAndNotify() error

CheckAndNotify checks TaniFund's projects and notify if there is new project.

func (*TaniFundProjectChecker) SetNumberOfProject

func (tpc *TaniFundProjectChecker) SetNumberOfProject(n int)

SetNumberOfProject sets the number of project to be retrieved at once.

type TaniFundProjectGetter

type TaniFundProjectGetter interface {
	// GetNewestProjects gets n newest TaniFund's projects.
	// The number of projcet can be set via parameter.
	GetNewestProjects(ctx context.Context, numberOfProject int) ([]*entity.Project, error)
}

TaniFundProjectGetter defines a contract to get TaniFund's projects.

type TaniFundProjectNotifier

type TaniFundProjectNotifier interface {
	// Notify notifies user about a project.
	Notify(ctx context.Context, recipientID int, project *entity.Project) error
}

TaniFundProjectNotifier defines a contract to user about TaniFund's project.

Jump to

Keyboard shortcuts

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