lindb

package
v0.0.0-...-3e848aa Latest Latest
Warning

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

Go to latest
Published: Sep 18, 2023 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Namespace MetadataType = "namespace"
	Metric                 = "metric"
	Field                  = "field"
	TagKey                 = "tagKey"
	TagValue               = "tagValue"
)

Defines all LinDB's metadata types.

View Source
var (
	Eq   Operator = "="
	In            = "in"
	GtEq          = ">="
	LtEq          = "<="
	Like          = "like"
)

Functions

func NewClient

func NewClient(datasource *model.Datasource, cfg json.RawMessage) (p plugin.DatasourcePlugin, err error)

NewClient creates a LinDB client.

Types

type DataQueryBuilder

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

DataQueryBuilder represents LinDB query language builder.

func New

func New() *DataQueryBuilder

New creates a builder.

func (*DataQueryBuilder) GroupBy

func (b *DataQueryBuilder) GroupBy(groupBy ...string) *DataQueryBuilder

GroupBy sets group by.

func (*DataQueryBuilder) Metric

func (b *DataQueryBuilder) Metric(metric string) *DataQueryBuilder

Metric sets metric name.

func (*DataQueryBuilder) Namespace

func (b *DataQueryBuilder) Namespace(namespace string) *DataQueryBuilder

Namespace sets namespace.

func (*DataQueryBuilder) Select

func (b *DataQueryBuilder) Select(fields ...string) *DataQueryBuilder

Select sets field list of query or functions.

func (*DataQueryBuilder) TimeRange

func (b *DataQueryBuilder) TimeRange(from, to string) *DataQueryBuilder

TimeRange sets time range.

func (*DataQueryBuilder) ToSQL

func (b *DataQueryBuilder) ToSQL() (sql string, err error)

ToSQL returns the LinDB query language based on params.

func (*DataQueryBuilder) Where

func (b *DataQueryBuilder) Where(where ...Expr) *DataQueryBuilder

Where sets where conditions.

type DataQueryRequest

type DataQueryRequest struct {
	Namespace string   `json:"namespace"`
	Metric    string   `json:"metric"`
	Fields    []string `json:"fields"`
	GroupBy   []string `json:"groupBy"`
	Where     []Expr   `json:"where"`
	Stats     bool     `json:"stats"`
}

DataQueryRequest represents data query request for LinDB.

type DatasourceConfig

type DatasourceConfig struct {
	Database string `json:"database"`
}

DatasourceConfig represents datasource config for LinDB.

type Expr

type Expr struct {
	Key   string   `json:"key"`
	Op    Operator `json:"operator"`
	Value any      `json:"value"`
	// contains filtered or unexported fields
}

Expr represents where condition express.

func (Expr) String

func (e Expr) String() string

String returns the string value of expr.

type MetadataQueryBuilder

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

MetadataQueryBuilder represents LinDB query language builder.

func NewBuilder

func NewBuilder(queryType MetadataType) *MetadataQueryBuilder

func (*MetadataQueryBuilder) Metric

Metric sets metric name.

func (*MetadataQueryBuilder) Namespace

func (b *MetadataQueryBuilder) Namespace(namespace string) *MetadataQueryBuilder

Namespace sets namespace.

func (*MetadataQueryBuilder) TagKey

TagKey sets tag key.

func (*MetadataQueryBuilder) ToSQL

func (b *MetadataQueryBuilder) ToSQL() (sql string, err error)

ToSQL returns the LinDB query language based on params.

func (*MetadataQueryBuilder) Where

func (b *MetadataQueryBuilder) Where(where ...Expr) *MetadataQueryBuilder

Where sets where conditions.

type MetadataQueryRequest

type MetadataQueryRequest struct {
	Type      MetadataType `json:"type"`
	Namespace string       `json:"namespace"`
	Metric    string       `json:"metric"`
	TagKey    string       `json:"tagKey"`
	Where     []Expr       `json:"where"`
}

MetadataQueryRequest represents metadata query request for LinDB.

type MetadataType

type MetadataType = string

MetadataType represents metadata type for LinDB.

type Operator

type Operator = string

Operator represents binary operator.

Jump to

Keyboard shortcuts

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