Documentation
¶
Index ¶
- type Goal
- type GoalRepository
- func (r *GoalRepository) BeginUpdateTxByUserID(ctx context.Context, userID string) (goals []*Goal, tx pgx.Tx, err error)
- func (r *GoalRepository) Create(ctx context.Context, g *Goal) (err error)
- func (r *GoalRepository) DeleteByID(ctx context.Context, id int64) (err error)
- func (r *GoalRepository) FindByID(ctx context.Context, id int64) (goal *Goal, err error)
- func (r *GoalRepository) FindByUserID(ctx context.Context, userID string) (goals []*Goal, err error)
- func (r *GoalRepository) UpdateTx(ctx context.Context, tx pgx.Tx, g *Goal) (err error)
- type GoalService
- func (s *GoalService) CheckAll(ctx context.Context, userID string) (goals []*Goal, err error)
- func (s *GoalService) CheckCompleted(ctx context.Context, a *activities.Activity) (completed []*Goal, err error)
- func (s *GoalService) NextCron(ctx context.Context, g *Goal) (t time.Time, err error)
- func (s *GoalService) PreviousCron(ctx context.Context, g *Goal) (t time.Time, err error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Goal ¶
type Goal struct {
ID int64
UserID string
Name string
ActivityType *string
MediaType *string
YoutubeChannels []string
Target time.Duration
Current time.Duration
Cron string
DueAt time.Time
CreatedAt time.Time
}
func (*Goal) MatchesActivity ¶
func (g *Goal) MatchesActivity(a *activities.Activity) bool
type GoalRepository ¶
type GoalRepository struct {
// contains filtered or unexported fields
}
func NewGoalRepository ¶
func NewGoalRepository(pool *pgxpool.Pool) *GoalRepository
func (*GoalRepository) BeginUpdateTxByUserID ¶
func (*GoalRepository) Create ¶
func (r *GoalRepository) Create(ctx context.Context, g *Goal) (err error)
func (*GoalRepository) DeleteByID ¶
func (r *GoalRepository) DeleteByID(ctx context.Context, id int64) (err error)
func (*GoalRepository) FindByUserID ¶
type GoalService ¶
type GoalService struct {
*GoalRepository
// contains filtered or unexported fields
}
func NewGoalService ¶
func NewGoalService(repo *GoalRepository, ts *users.UserTimeService) *GoalService
func (*GoalService) CheckCompleted ¶
func (s *GoalService) CheckCompleted(ctx context.Context, a *activities.Activity) (completed []*Goal, err error)
func (*GoalService) PreviousCron ¶
Click to show internal directories.
Click to hide internal directories.