filterpolicy

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jan 30, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Never

func Never() time.Time

Types

type Item

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

Item is a policy item, a part of Item

func NewItem

func NewItem(spec string) (*Item, error)

NewItem create a new policy item from a specification <integer>: represents exact match */<integer>: represents the number should be divisible by <ingeger> <max-integer>-<max-ingeter>: represents a number range, only numbers in this range can be passed eg. 34 or */3 or 3-12

func (*Item) NextTime

func (item *Item) NextTime(start time.Time, current time.Time) time.Time

func (*Item) Pass

func (item *Item) Pass(start, current time.Time) bool

func (*Item) PassedBefore

func (item *Item) PassedBefore(start, current time.Time) bool

type Policy

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

Policy is a real policy executor

func Parse

func Parse(spec string) (*Policy, error)

Parse create a new FilterPolicy from a given specification eg. 1,2,3,25,100 will pass 1,2,3,25 and 100. others will not

func (*Policy) NextTime

func (policy *Policy) NextTime(start time.Time, current time.Time) time.Time

func (*Policy) Pass

func (policy *Policy) Pass(start, current time.Time) bool

Pass 检查当前时间是否满足策略

func (*Policy) PassedBefore

func (policy *Policy) PassedBefore(start, current time.Time) bool

PassedBefore 判断在 current 时间之前,是否存在一个时间点满足策略

func (*Policy) Stop

func (policy *Policy) Stop()

Stop ...

Jump to

Keyboard shortcuts

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