Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // MinuteParser is a parser to parse the minute component of a cron expression MinuteParser = NewParser(numberer.MinuteFactory) // HourParser is a parser to parse the hour component of a cron expression HourParser = NewParser(numberer.HourFactory) // DayOfMonthParser is a parser to parse the day of month component of a cron expression DayOfMonthParser = NewParser(numberer.DayOfMonthFactory) // MonthParser is a parser to parse the month component of a cron expression MonthParser = NewParser(numberer.MonthFactory) // DayOfWeekParser is a parser to parse the day of week component of a cron expression DayOfWeekParser = NewParser(numberer.DayOfWeekFactory) )
Functions ¶
This section is empty.
Types ¶
type Adapter ¶
type Adapter struct { PartsFactory PartsProvider NumbererFactory NumbererProvider }
Adapter is a type that can adapt the PartsProvider and the Provider into a Parser
func NewAdapter ¶
func NewAdapter(provider NumbererProvider) Adapter
NewAdapter will return you a new instance of an Adapter, with a Partitioner as its PartsFactory
type AggregateNumberer ¶
type AggregateNumberer []Numberer
AggregateNumberer is a Numberer that will grab values from all of the contained numberers combining them
func (AggregateNumberer) Numbers ¶
func (a AggregateNumberer) Numbers() []int
Numbers implements the Numberer interface and will produce an ordered, de-duplicated list of all of the numbers contained within the AggregateNumberer
type BaseNumbererFactory ¶
BaseNumbererFactory is a type that wraps numberer.Provider and will return the correct numberer for a given parsed part
func NewBaseNumbererFactory ¶
func NewBaseNumbererFactory(factory numberer.Provider) BaseNumbererFactory
NewBaseNumbererFactory is a type that can give you a new instance of the BaseNumbererFactory
type Numberer ¶
type Numberer interface {
Numbers() []int
}
Numberer is an interface that represents the ability to get a set of numbers from a statement/numberer of a statement
type NumbererProvider ¶
NumbererProvider is a type that represents a type that can give you numbers for a numberer
type Parser ¶
Parser is the interface that represents a type that can parse numberer of a cron statement into a Numberer
type Part ¶
type Part []Token
Part is a group of tokens, that represent a single item, within a field of a cron expression, e.g. (0-30/5) within an a field like "0-30/5,40,50"
type Partitioner ¶
type Partitioner struct {
TokenSource func(input string) TokenSource
}
Partitioner is a type that adapts a Tokeniser into a list of Parts
func NewPartitioner ¶
func NewPartitioner() Partitioner
NewPartitioner is a type that can parse a field of a cron statement into it's constituent parts
type PartsProvider ¶
PartsProvider is an interface that represents a type that can parse a field of a cron expression into it's constituent parts
type StepNumberer ¶
StepNumberer is a type that decorates Numberer, and only returns values from the base if they are in the step of the Step member
func (StepNumberer) Numbers ¶
func (s StepNumberer) Numbers() []int
Numbers implements Numberer and will return the number only if step mod index == 0
type StepNumbererFactory ¶
type StepNumbererFactory struct {
Base NumbererProvider
}
StepNumbererFactory is a decorator of a Provider
func NewStepNumbererFactory ¶
func NewStepNumbererFactory(base NumbererProvider) StepNumbererFactory
NewStepNumbererFactory will create a new instance of StepNumbererFactory wrapping a base factory
type TokenSource ¶
type TokenSource interface {
Tokens() chan Token
}
TokenSource is an interface that represents a type that can emmit a stream of tokens
func NewTokenSource ¶
func NewTokenSource(input string) TokenSource
NewTokenSource will return, and start the Tokeniser for a given input string
type TokenType ¶
type TokenType int
TokenType is a type that represents the type of a value within the field of a cron statement
type Tokeniser ¶
type Tokeniser struct { Input string Start, Pos, Width int StartState StateFunc // contains filtered or unexported fields }
Tokeniser is a type that provides utilities for creating a state machine to tokenise an input string
func NewTokeniser ¶
NewTokeniser will return a new *Tokeniser with the start state as lexField
func (*Tokeniser) AcceptNumber ¶
func (t *Tokeniser) AcceptNumber()
AcceptNumber will call next for as long as the rune is a numeric value
func (*Tokeniser) Backup ¶
func (t *Tokeniser) Backup()
Backup will move back one character in the input stream
func (*Tokeniser) Emit ¶
Emit will emit a token of the given type, and set the start of the current section to the current position
func (*Tokeniser) Errorf ¶
Errorf will return an error token, and will return nil as a StateFunc, ending tokenisation
type Types ¶
type Types []TokenType
Types is a slice of token types, allows methods to be added to allow for pattern matching different sequences of tokens
func (Types) Contains ¶
Contains tells you whether a specific TokenType is contained within this array of types
func (Types) StartsWith ¶
StartsWith tells you whether the first type within a slice of TokenTypes is the same as the type provided