query

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Aug 3, 2021 License: AGPL-3.0 Imports: 16 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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 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 indexmanager.Index) 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