query

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Jan 6, 2022 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TimestampKey   = tsql.TimestampKey
	NameKey        = tsql.NameKey
	TagKey         = "tags"
	FieldKey       = "fields"
	ClusterNameKey = TagKey + ".cluster_name"
)

metric keys

Variables

This section is empty.

Functions

func BuildBoolQuery

func BuildBoolQuery(filters []*Filter, boolQuery *elastic.BoolQuery) error

BuildBoolQuery .

func ConvertAstToStatement

func ConvertAstToStatement(statement string) (string, error)

ConvertAstToStatement .

func ElasticSearchCURL

func ElasticSearchCURL(url string, indices []string, source interface{}) string

ElasticSearchCURL .

func ParseTimeRange

func ParseTimeRange(start, end, timestamp, latest string) (st int64, et int64, err error)

ParseTimeRange .

func ParseTimestamp

func ParseTimestamp(value string, now int64) (int64, error)

ParseTimestamp .

Types

type AstField

type AstField struct {
	Expr  string `json:"expr"`
	Alias string `json:"alias"`
	Key   string `json:"key"`
}

AstField .

type AstStatement

type AstStatement struct {
	Select  []*AstField `json:"select"`
	From    []string    `json:"from"`
	Where   []string    `json:"where"`
	GroupBy []string    `json:"groupby"`
	OrderBy []*OrderBy  `json:"orderby"`
	Limit   int64       `json:"limit"`
}

AstStatement .

type Filter

type Filter struct {
	Key      string
	Operator string
	Value    interface{}
}

Filter .

func ParseFilters

func ParseFilters(params url.Values) (filters []*Filter, ps map[string]interface{})

ParseFilters .

type IndexLoader added in v1.4.0

type IndexLoader interface {
	indexloader.Interface
	GetIndices(metrics, clusters []string, start, end int64) []string
}

IndexLoader .

type MetricIndexLoader added in v1.4.0

type MetricIndexLoader struct {
	indexloader.Interface
}

MetricIndexLoader .

func (*MetricIndexLoader) GetIndices added in v1.4.0

func (mi *MetricIndexLoader) GetIndices(metrics, clusters []string, start, end int64) []string

type OrderBy

type OrderBy struct {
	Expr string `json:"expr"`
	Dir  string `json:"dir"`
}

OrderBy .

type Queryer

type Queryer interface {
	Query(tsql, statement string, params map[string]interface{}, options url.Values) (*ResultSet, error)
	QueryWithFormat(tsql, statement, format string, langCodes i18n.LanguageCodes, params map[string]interface{}, filters []*Filter, options url.Values) (*ResultSet, interface{}, error)
	Export(tsql, statement string, params map[string]interface{}, options url.Values, handle func(id string, source []byte) error) error // 暂时没用到, 待移除

	QueryRaw(metrics, clusters []string, start, end int64, searchSource *elastic.SearchSource) (*elastic.SearchResult, error)
	SearchRaw(indices []string, searchSource *elastic.SearchSource) (*elastic.SearchResult, error)
}

Queryer .

func New

func New(index IndexLoader) Queryer

New .

type ResultSet

type ResultSet struct {
	*tsql.ResultSet
	Details interface{}
	Elapsed struct {
		Search time.Duration `json:"search"`
	} `json:"elapsed"`
}

ResultSet .

Directories

Path Synopsis
v1

Jump to

Keyboard shortcuts

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