filterpolicy

package
v0.0.0-...-693abe4 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2019 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FilterPolicy

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

FilterPolicy is a real policy executor

func ParseFilterPolicy

func ParseFilterPolicy(spec string) (*FilterPolicy, error)

ParseFilterPolicy 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 (*FilterPolicy) Pass

func (policy *FilterPolicy) Pass(i int) bool

Pass check if a given ingeter can pass the policy

func (*FilterPolicy) PassedBefore

func (policy *FilterPolicy) PassedBefore(repeat int) bool

PassedBefore check if the policy pass number which smaller(or equal) than repeat

type FilterPolicyItem

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

FilterPolicyItem is a policy item, a part of FilterPolicyItem

func NewFilterPolicyItem

func NewFilterPolicyItem(spec string) (*FilterPolicyItem, error)

NewFilterPolicyItem 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 (*FilterPolicyItem) Pass

func (item *FilterPolicyItem) Pass(i int) bool

Pass check if the given integer can pass the policy

Jump to

Keyboard shortcuts

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