skipper: github.com/zalando/skipper/predicates/interval Index | Files

package interval

import "github.com/zalando/skipper/predicates/interval"

Package interval implements custom predicates to match routes only during some period of time.

Package includes three predicates: Between, Before and After. All predicates can be created using the date represented as a string in RFC3339 format (see https://golang.org/pkg/time/#pkg-constants), int64 or float64 number. float64 number will be converted into int64 number.

Between predicate matches only if current date is inside the specified range of dates. Between predicate requires two dates to be constructed. Upper boundary must be after lower boundary. Range includes the lower boundary, but excludes the upper boundary.

Before predicate matches only if current date is before the specified date. Only one date is required to construct the predicate.

After predicate matches only if current date is after or equal to the specified date. Only one date is required to construct the predicate.

Examples:

example1: Path("/zalando") && Between("2016-01-01T12:00:00+02:00", "2016-02-01T12:00:00+02:00") -> "https://www.zalando.de";
example2: Path("/zalando") && Between(1451642400, 1454320800) -> "https://www.zalando.de";

example3: Path("/zalando") && Before("2016-02-01T12:00:00+02:00") -> "https://www.zalando.de";
example4: Path("/zalando") && Before(1454320800) -> "https://www.zalando.de";

example3: Path("/zalando") && After("2016-01-01T12:00:00+02:00") -> "https://www.zalando.de";
example4: Path("/zalando") && After(1451642400) -> "https://www.zalando.de";

Index

Package Files

interval.go

func NewAfter Uses

func NewAfter() routing.PredicateSpec

Creates After predicate.

func NewBefore Uses

func NewBefore() routing.PredicateSpec

Creates Before predicate.

func NewBetween Uses

func NewBetween() routing.PredicateSpec

Creates Between predicate.

Package interval imports 4 packages (graph) and is imported by 6 packages. Updated 2016-07-25. Refresh now. Tools for package owners.