schedule

package
v1.9.7 Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2019 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package schedule defines the interface for scheduling of slackscot actions

Index

Constants

View Source
const (
	Weeks   = "weeks"
	Hours   = "hours"
	Days    = "days"
	Minutes = "minutes"
	Seconds = "seconds"
)

Unit values

Variables

This section is empty.

Functions

func NewJob

func NewJob(s *gocron.Scheduler, def Definition) (j *gocron.Job, err error)

NewJob sets up the gocron.Job with the schedule and leaves the task undefined for the caller to set up

Types

type Definition

type Definition struct {
	// Internal value (every 1 minute would be expressed with an interval of 1). Must be set explicitly or implicitly (a weekday value implicitly sets the interval to 1)
	Interval uint64

	// Must be set explicitly or implicitly ("weeks" is implicitly set when "Weekday" is set). Valid time units are: "weeks", "hours", "days", "minutes", "seconds"
	Unit string

	// Optional day of the week. If set, unit and interval are ignored and implicitly considered to be "every 1 week"
	Weekday string

	// Optional "at time" value (i.e. "10:30")
	AtTime string
}

Definition holds the data defining a schedule definition

func (Definition) String

func (d Definition) String() string

Returns a human-friendly string for the schedule definition

Jump to

Keyboard shortcuts

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