schedule

package
v3.0.0-rc2+incompatible Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2021 License: AGPL-3.0 Imports: 5 Imported by: 0

Documentation

Overview

Package schedule provides a fixed ticker based on a start time iso8601 interval periods are supported

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type OnTick

type OnTick func() error

type Ticker

type Ticker struct {
	*TickerSchedule
	// contains filtered or unexported fields
}

Ticker provides an easy way to execute a job at given times (like a cron job).

func NewTicker

func NewTicker(schedule *TickerSchedule, onTick OnTick) *Ticker

NewTicker creates a new waiter that sends start events for this job on the given schedule

func (*Ticker) Start

func (w *Ticker) Start()

Start starts the waiter

func (*Ticker) Stop

func (w *Ticker) Stop()

Stop simply stops the waiter

func (*Ticker) WaitUntilNext

func (w *Ticker) WaitUntilNext()

WaitUntilNext implements the intelligence of the waiter.

type TickerSchedule

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

TickerSchedule contains all info about the scheduling (start, repeat, interval)

func NewTickerSchedule

func NewTickerSchedule(interval time.Duration, startTime time.Time, repeat int64) *TickerSchedule

NewTickerSchedule creates a schedule from parameters

func NewTickerScheduleFromISO

func NewTickerScheduleFromISO(is8601 string) (*TickerSchedule, error)

NewTickerScheduleFromISO creates a schedule from an iso8601 string. It can return an error if the string is not properly formatted or empty.

func (*TickerSchedule) ParseIsoSchedule

func (s *TickerSchedule) ParseIsoSchedule() error

ParseSchedule parses the given Iso 8601 string and stores corresponding values.

Jump to

Keyboard shortcuts

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