cronexpr

package
v1.2.5 Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2022 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package cronexpr parses cron time expressions.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Expression

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

A Expression represents a specific cron time expression as defined at

func Parse

func Parse(cronLine string) (*Expression, error)

Parse 解析表达式

func (*Expression) Next

func (expr *Expression) Next(fromTime, startDate, endDate time.Time) (time.Time, error)

NextN returns a slice of `n` closest time instants immediately following `fromTime` which match the cron expression `expr`.

The time instants in the returned slice are in chronological ascending order. The `time.Location` of the returned time instants is the same as that of `fromTime`.

The start time The `time.Location` of the returned time instants is the same as that of `startDate`.

The end time The `time.Location` of the returned time instants is the same as that of `endDate`.

A slice with len between [0-`n`] is returned, that is, if not enough existing matching time instants exist, the number of returned entries will be less than `n`.

func (*Expression) NextN

func (expr *Expression) NextN(fromTime, startDate time.Time, n int) (listCron []time.Time, e error)

NextN returns a slice of `n` closest time instants immediately following `fromTime` which match the cron expression `expr`.

The time instants in the returned slice are in chronological ascending order. The `time.Location` of the returned time instants is the same as that of `fromTime`.

The start time The `time.Location` of the returned time instants is the same as that of `startDate`.

A slice with len between [0-`n`] is returned, that is, if not enough existing matching time instants exist, the number of returned entries will be less than `n`.

func (*Expression) Validate

func (expr *Expression) Validate(curTime, startTime time.Time) (*Expression, error)

Validate 验证

Jump to

Keyboard shortcuts

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