window

package
v0.14.1 Latest Latest
Warning

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

Go to latest
Published: Jun 25, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const NewWindowVersion = 3

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Preset string
	// kept for backward compatibility, will be removed later
	Window models.Window
	// contains filtered or unexported fields
}

func NewConfig added in v0.11.0

func NewConfig(size, shiftBy, location, truncateTo string) (Config, error)

func NewCustomConfig

func NewCustomConfig(w models.Window) Config

func NewCustomConfigWithTimezone added in v0.11.0

func NewCustomConfigWithTimezone(c SimpleConfig) Config

func NewIncrementalConfig

func NewIncrementalConfig() Config

func NewPresetConfig

func NewPresetConfig(preset string) (Config, error)

func (Config) GetOffset

func (c Config) GetOffset() string

func (Config) GetSimpleConfig added in v0.11.0

func (c Config) GetSimpleConfig() SimpleConfig

func (Config) GetSize

func (c Config) GetSize() string

func (Config) GetTruncateTo

func (c Config) GetTruncateTo() string

func (Config) GetVersion

func (c Config) GetVersion() int

func (Config) Type

func (c Config) Type() Type

type CustomWindow added in v0.11.0

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

func FromCustomConfig added in v0.11.0

func FromCustomConfig(c SimpleConfig) (CustomWindow, error)

func NewCustomWindow added in v0.11.0

func NewCustomWindow(size, shiftBy duration.Duration, location *time.Location, truncateTo string) CustomWindow

TODO: this function is not used anywhere at the moment, consider removing it

func (CustomWindow) GetEnd added in v0.11.0

func (w CustomWindow) GetEnd(ref time.Time) (time.Time, error)

func (CustomWindow) GetInterval added in v0.11.0

func (w CustomWindow) GetInterval(ref time.Time) (interval.Interval, error)

type IncrementalWindow added in v0.11.0

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

func FromSchedule

func FromSchedule(schedule string) (IncrementalWindow, error)

func (IncrementalWindow) GetInterval added in v0.11.0

func (w IncrementalWindow) GetInterval(referenceTime time.Time) (interval.Interval, error)

type OldWindow added in v0.11.0

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

func FromBaseWindow

func FromBaseWindow(w models.Window) OldWindow

func (OldWindow) GetInterval added in v0.11.0

func (w OldWindow) GetInterval(referenceTime time.Time) (interval.Interval, error)

type SimpleConfig added in v0.11.0

type SimpleConfig struct {
	Size       string
	ShiftBy    string
	Location   string
	TruncateTo string // TODO: remove later if unused
}

func NewSimpleConfig added in v0.11.0

func NewSimpleConfig(size, shiftBy, location, truncateTo string) (SimpleConfig, error)

type Type

type Type string
const (
	Incremental Type = "incremental"
	Preset      Type = "preset"
	Custom      Type = "custom"
)

type Window

type Window interface {
	GetInterval(referenceTime time.Time) (interval.Interval, error)
}

func From

func From[T WithConfig](config Config, schedule string, getter func(string) (T, error)) (Window, error)

type WithConfig added in v0.11.0

type WithConfig interface {
	Config() SimpleConfig
}

Jump to

Keyboard shortcuts

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