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 ¶
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.