window

package
v0.0.0-...-a26ebea Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2022 License: AGPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrHiGreaterThanLo = validation.NewError(
	"window_hi_must_be_greater_than_lo",
	"the window hi value must be greater than the lo value",
)

ErrHiGreaterThanLo is the validation check error returned when the window hi is before the lo.

View Source
var ErrLoMustBeNewerThanUnixEpoch = validation.NewError(
	"window_lo_must_be_newer_than_unix_epoch",
	fmt.Sprintf("the window lo value must be newer than %s", unixEpoch),
)

ErrLoMustBeNewerThanUnixEpoch is the validation check error returned when the window is before the unix epoch (Jan 1st, 1970).

Functions

This section is empty.

Types

type Window

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

func Generate

func Generate(rand *rand.Rand) Window

Generate a random Window value.

func New

func New(lo, hi time.Time) (Window, validation.ErrorGroup)

New creates and validates a new Window from the given values.

func (Window) Check

func (w Window) Check() validation.ErrorGroup

Check runs default validation checks for the Window.

func (Window) Duration

func (w Window) Duration() time.Duration

Duration returns the time duration of the window.

func (Window) Equals

func (w Window) Equals(v any) bool

Equals compares two Window instances for equality.

Interface: comparison.Equaler

func (Window) Generate

func (Window) Generate(rand *rand.Rand, size int) reflect.Value

Generate random Window values.

Interface: quick.Generator

func (Window) Overlaps

func (w Window) Overlaps(w2 Window) bool

Overlaps returns true when the two time windows overlap.

func (Window) String

func (w Window) String() string

String value of the Window.

Interface: fmt.Stringer.

Jump to

Keyboard shortcuts

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