interval

package
v0.0.85-test Latest Latest
Warning

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

Go to latest
Published: May 8, 2023 License: AGPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DefaultRes int64 = 1500
)

Functions

func FormatDuration

func FormatDuration(inter time.Duration) string

FormatDuration converts a duration into the kbn format e.g. 1m 2h or 3d

func GetIntervalFrom

func GetIntervalFrom(dsInfo *models.DataSource, queryModel *simplejson.Json, defaultInterval time.Duration) (time.Duration, error)

func NewCalculator

func NewCalculator(opts ...CalculatorOptions) *intervalCalculator

Types

type Calculator

type Calculator interface {
	Calculate(timeRange legacydata.DataTimeRange, interval time.Duration) Interval
	CalculateSafeInterval(timeRange legacydata.DataTimeRange, resolution int64) Interval
}

type CalculatorOptions

type CalculatorOptions struct {
	MinInterval time.Duration
}

type Interval

type Interval struct {
	Text  string
	Value time.Duration
}

func (*Interval) Milliseconds

func (i *Interval) Milliseconds() int64

Jump to

Keyboard shortcuts

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