Documentation ¶
Index ¶
- type PomodoroManager
- type TimeKeeper
- func (t *TimeKeeper) Pause(uID string) error
- func (t *TimeKeeper) Resume(uID string) error
- func (t *TimeKeeper) Start(uID string, duration time.Duration, actions ...func()) (string, error)
- func (t *TimeKeeper) StartWithTime(uID string, start time.Time, duration time.Duration, actions ...func()) (string, error)
- func (t *TimeKeeper) Stop(uID string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type PomodoroManager ¶
type PomodoroManager interface { StartWithTime(uID string, start time.Time, duration time.Duration, actions ...func()) (string, error) Start(uID string, duration time.Duration, actions ...func()) (string, error) Resume(uID string) error Pause(uID string) error Stop(uID string) error }
PomodoroManager represents the methods necessary to implement gomato for easy testing
type TimeKeeper ¶
type TimeKeeper struct {
// contains filtered or unexported fields
}
TimeKeeper represents the necessary components to manage pomodoros
func NewDefaultTimeKeeper ¶
func NewDefaultTimeKeeper() *TimeKeeper
NewDefaultTimeKeeper instantiates a TimeKeeper with default logging and cache options
func NewTimeKeeper ¶
func NewTimeKeeper(l *log.Logger, c *gcache.Cache) *TimeKeeper
NewTimeKeeper instantiates a TimeKeeper object
func (*TimeKeeper) Pause ¶
func (t *TimeKeeper) Pause(uID string) error
Pause pauses a timer with the given user ID
func (*TimeKeeper) Resume ¶
func (t *TimeKeeper) Resume(uID string) error
Resume resumes a paused timer with the given user ID
func (*TimeKeeper) Start ¶
Start begins a new pomodoro without the need to pass in a start time A user identifier should be passed through, but if it is not then it will be generated and returned
func (*TimeKeeper) StartWithTime ¶
func (t *TimeKeeper) StartWithTime(uID string, start time.Time, duration time.Duration, actions ...func()) (string, error)
StartWithTime begins a new pomodoro A user identifier should be passed through, but if it is not then it will be generated and returned
func (*TimeKeeper) Stop ¶
func (t *TimeKeeper) Stop(uID string) error
Stop stops a timer (running or paused) and deletes it from the cache