Version: v0.13.177 Latest Latest

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

Go to latest
Published: Jan 26, 2022 License: Apache-2.0, MIT Imports: 4 Imported by: 5



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 - a string in RFC3339 format without numeric timezone offset and a location name (see - an int64 or float64 number corresponding to the given Unix time in seconds since January 1, 1970 UTC.

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.


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

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

example5: Path("/zalando") && After("2016-01-01T12:00:00+02:00") -> "";
example6: Path("/zalando") && After(1451642400) -> "";

example7: Path("/zalando") && Between("2021-02-18T00:00:00", "2021-02-18T01:00:00", "Europe/Berlin") -> "";
example8: Path("/zalando") && Before("2021-02-18T00:00:00", "Europe/Berlin") -> "";
example9: Path("/zalando") && After("2021-02-18T00:00:00", "Europe/Berlin") -> "";



This section is empty.


This section is empty.


func NewAfter

func NewAfter() routing.PredicateSpec

Creates After predicate.

func NewBefore

func NewBefore() routing.PredicateSpec

Creates Before predicate.

func NewBetween

func NewBetween() routing.PredicateSpec

Creates Between predicate.


This section is empty.

Source Files

Jump to

Keyboard shortcuts

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