common

package
v4.2.724+incompatible Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2020 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	AggregationOverTime = map[AggregateFunction]string{
		MaxOverTime: "max_over_time",
		AvgOverTime: "avg_over_time",
	}

	TimeRange2AggregationOverTime = map[Common.TimeRange_AggregateFunction]AggregateFunction{
		Common.TimeRange_NONE: None,
		Common.TimeRange_MAX:  MaxOverTime,
		Common.TimeRange_AVG:  AvgOverTime,
	}
)
View Source
var (
	DefaultStepTime, _ = time.ParseDuration("30s")
)

Functions

This section is empty.

Types

type AggregateFunction

type AggregateFunction = int

Aggregate function enumerator

const (
	None        AggregateFunction = 0
	MaxOverTime AggregateFunction = 1
	AvgOverTime AggregateFunction = 2
)

Aggregation function definition

type Condition added in v0.9.166

type Condition struct {
	Keys      []string
	Values    []string
	Operators []string
	Types     []DataType
}

type DataType added in v0.9.166

type DataType int

Data type enumerator

const (
	Invalid DataType = iota
	Bool
	Int
	Int8
	Int16
	Int32
	Int64
	Uint
	Uint8
	Uint16
	Uint32
	Uint64
	Float32
	Float64
	String
)

Data type definition

type Group added in v0.9.166

type Group struct {
	Columns []string
	Rows    []*Row
}

type Option

type Option func(*Options)

func AggregateOverTimeFunc

func AggregateOverTimeFunc(f AggregateFunction) Option

func EndTime

func EndTime(t *time.Time) Option

func StartTime

func StartTime(t *time.Time) Option

func StepTime

func StepTime(d *time.Duration) Option

func Timeout

func Timeout(t *time.Time) Option

type Options

type Options struct {
	StartTime             *time.Time
	EndTime               *time.Time
	Timeout               *time.Time
	StepTime              *time.Duration
	AggregateOverTimeFunc AggregateFunction
}

func NewDefaultOptions

func NewDefaultOptions() Options

type Order

type Order = int

Order enumerator

const (
	NoneOrder Order = iota
	Asc             // Represent ascending order
	Desc            // Represent descending order
)

Sort order definition

type QueryCondition

type QueryCondition struct {
	StartTime                 *time.Time
	EndTime                   *time.Time
	Timeout                   *time.Time
	StepTime                  *time.Duration
	TimestampOrder            Order
	WhereClause               string
	WhereCondition            []*Condition
	Selects                   []string
	Groups                    []string
	Limit                     int
	AggregateOverTimeFunction AggregateFunction
}

QueryCondition Others query condition

func BuildQueryCondition

func BuildQueryCondition(condition *Common.QueryCondition) QueryCondition

func BuildQueryConditionV1

func BuildQueryConditionV1(condition *ApiCommon.QueryCondition) *QueryCondition

func NewQueryCondition added in v0.9.166

func NewQueryCondition(days, hours, seconds, steps int) *QueryCondition

type Row added in v0.9.166

type Row struct {
	Time   *time.Time
	Values []string
}

Jump to

Keyboard shortcuts

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