Documentation ¶ Index ¶ Variables type Timer func NewTimer(duration time.Duration, worker Worker, logger log.FieldsLogger) (*Timer, error) func (t *Timer) Run(ctx context.Context, isblock, skipfirst bool) error func (t *Timer) Stop() error type Worker Constants ¶ This section is empty. Variables ¶ View Source var ( ErrNilWorker = errors.New("worker is nil") ErrNilLogger = errors.New("logger is nil") ErrHadRunned = errors.New("timer had runned") ErrNotRun = errors.New("timer not run") ) Functions ¶ This section is empty. Types ¶ type Timer ¶ type Timer struct { Duration time.Duration Logger log.FieldsLogger // contains filtered or unexported fields } func NewTimer ¶ func NewTimer(duration time.Duration, worker Worker, logger log.FieldsLogger) (*Timer, error) func (*Timer) Run ¶ func (t *Timer) Run(ctx context.Context, isblock, skipfirst bool) error func (*Timer) Stop ¶ func (t *Timer) Stop() error type Worker ¶ type Worker interface { Do(ctx context.Context, logger log.FieldsLogger) (end bool) Done(ctx context.Context, logger log.FieldsLogger) } Source Files ¶ View all Source files timer.goworker.go Click to show internal directories. Click to hide internal directories.