interval

package
v0.192.0 Latest Latest
Warning

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

Go to latest
Published: Jan 9, 2023 License: MIT Imports: 6 Imported by: 4

Documentation

Index

Constants

View Source
const (
	MaxTime = math.MaxInt64
	MinTime = math.MinInt64
)

Variables

View Source
var UTC = Location{}

UTC is the UTC zone with no additional offset.

Functions

This section is empty.

Types

type Bounds

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

func NewBounds added in v0.105.0

func NewBounds(start, stop values.Time) Bounds

NewBounds create a new Bounds given start and stop values

func (Bounds) Contains

func (b Bounds) Contains(t values.Time) bool

func (Bounds) Equal

func (b Bounds) Equal(o Bounds) bool

func (Bounds) Intersect added in v0.105.0

func (b Bounds) Intersect(o Bounds) Bounds

Intersect returns the intersection of two bounds. It returns empty bounds if one of the input bounds are empty. TODO: there are several places that implement bounds and related utilities.

consider a central place for them?

func (Bounds) IsEmpty

func (b Bounds) IsEmpty() bool

func (Bounds) IsZero added in v0.105.0

func (b Bounds) IsZero() bool

IsZero returns true if the start and stop values are both zero.

func (Bounds) Length

func (b Bounds) Length() values.Duration

func (Bounds) Overlaps

func (b Bounds) Overlaps(o Bounds) bool

func (Bounds) Start

func (b Bounds) Start() values.Time

func (Bounds) Stop

func (b Bounds) Stop() values.Time

func (Bounds) String

func (b Bounds) String() string

func (Bounds) Union added in v0.105.0

func (b Bounds) Union(o Bounds) Bounds

Union returns the smallest bounds which contain both input bounds. It returns empty bounds if one of the input bounds are empty.

type Location added in v0.134.0

type Location struct {

	// Offset declares an additional offset that will be applied.
	Offset values.Duration
	// contains filtered or unexported fields
}

Location is a Location that can be passed to Window to make the window timezone-aware.

func LoadLocation added in v0.134.0

func LoadLocation(name string) (Location, error)

func (Location) Equal added in v0.134.0

func (l Location) Equal(other Location) bool

type Window

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

TODO(nathanielc): Make the epoch a parameter to the window See https://github.com/influxdata/flux/issues/2093

Window is a description of an infinite set of boundaries in time.

Note the properties of this struct should remain private. Furthermore they should not be exposed via public getter methods. There should never be any need to access a window's properties in order to perform window calculations. The public interface should be sufficient.

func NewWindow

func NewWindow(every, period, offset values.Duration) (Window, error)

NewWindow creates a window which can be used to determine the boundaries for a given point. Window boundaries start at the epoch plus the offset. Each subsequent window starts at a multiple of the every duration. Each window's length is the start boundary plus the period. Every must not be a mix of months and nanoseconds in order to preserve constant time bounds lookup.

func NewWindowInLocation added in v0.133.0

func NewWindowInLocation(every, period, offset values.Duration, loc Location) (Window, error)

NewWindowInLocation creates a window the same as NewWindow within the given location. Windows that are location-aware will take into account zone offset changes such as daylight savings time and other changes that occur to the location's clock time.

func (Window) Every added in v0.105.0

func (w Window) Every() values.Duration

func (Window) GetLatestBounds

func (w Window) GetLatestBounds(t values.Time) Bounds

GetLatestBounds returns the bounds for the latest window bounds that contains the given time t. For underlapping windows that do not contain time t, the window directly before time t will be returned.

func (Window) GetOverlappingBounds

func (w Window) GetOverlappingBounds(start, stop values.Time) []Bounds

GetOverlappingBounds returns a slice of bounds that overlaps the input bounds. The returned set of bounds are ordered by decreasing time.

func (Window) IsZero added in v0.103.1

func (w Window) IsZero() bool

IsZero checks if the window's every duration is zero

func (Window) NextBounds

func (w Window) NextBounds(b Bounds) Bounds

NextBounds returns the next boundary in sequence from the given boundary.

func (Window) Period added in v0.105.0

func (w Window) Period() values.Duration

func (Window) PrevBounds

func (w Window) PrevBounds(b Bounds) Bounds

PrevBounds returns the previous boundary in sequence from the given boundary.

Jump to

Keyboard shortcuts

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