cronmask

package module
v0.0.0-...-54e2930 Latest Latest
Warning

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

Go to latest
Published: Aug 1, 2023 License: Apache-2.0 Imports: 5 Imported by: 1

README

Build Status codecov Go Report Card License GoDoc

cronmask

Library that supports cron-like expressions to check if a time fits into a time range

For CRON expressions:

Expressions are expected to be in the same time zone as the system that generates the time.Time instances.

You can check the tests for what is possible.

Unsupported features:

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CronMask

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

CronMask interface exposes a method to check whether the given time.Time matches the expression CronMask was constructed with.

func New

func New(expr string) (*CronMask, error)

New constructs a new CronMask instance that can be used to check if a given time.Time matches the expression or not.

For CRON expressions (https://en.wikipedia.org/wiki/Cron#CRON_expression):

Expressions are expected to be in the same time zone as the system that generates the time.Time instances.

You can check the tests for what is possible.

Unsupported features:

- Non-standard characters (https://en.wikipedia.org/wiki/Cron#Non-standard_characters)

- Year field

- Command section

- Text representation of the fields "month" and "day of week"

func (*CronMask) Match

func (c *CronMask) Match(t time.Time) bool

Jump to

Keyboard shortcuts

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