Documentation ¶
Index ¶
- Constants
- func BinaryOPString(op BinaryOP) string
- func Marshal(expr Expr) []byte
- type BinaryExpr
- type BinaryOP
- type Broker
- type BrokerOpType
- type CallExpr
- type EqualsExpr
- type Expr
- type FieldExpr
- type InExpr
- type LikeExpr
- type Limit
- type LimitOpType
- type Metadata
- type MetadataType
- type MetricMetadata
- type MetricMetadataType
- type NotExpr
- type NumberLiteral
- type OrderByExpr
- type ParenExpr
- type Query
- type RegexExpr
- type Request
- type Schema
- type SchemaType
- type SelectItem
- type SourceType
- type State
- type StateType
- type Statement
- type StatementType
- type Storage
- type StorageOpType
- type TagFilter
- type Use
Constants ¶
const ( // StateRepoSource represents from state persist repo. StateRepoSource = iota + 1 // StateMachineSource represents from state machine in current memory. StateMachineSource )
Variables ¶
This section is empty.
Functions ¶
func BinaryOPString ¶
BinaryOPString returns the binary operator's string value
Types ¶
type BinaryExpr ¶
BinaryExpr represents an operations with two expressions
func (*BinaryExpr) Rewrite ¶
func (e *BinaryExpr) Rewrite() string
Rewrite rewrites the binary expr after parse
type Broker ¶ added in v0.2.4
type Broker struct { Type BrokerOpType Value string }
Broker represent broker statement.
func (*Broker) StatementType ¶ added in v0.2.4
func (q *Broker) StatementType() StatementType
StatementType returns broker query type.
type BrokerOpType ¶ added in v0.2.4
type BrokerOpType int
BrokerOpType represents broker related operation.
const ( // BrokerOpUnknown represents unknown operation. BrokerOpUnknown BrokerOpType = iota // BrokerOpCreate represents create broker. BrokerOpCreate // BrokerOpShow represent show broker. BrokerOpShow // BrokerOpDelete represents delete broker. BrokerOpDelete )
type EqualsExpr ¶
EqualsExpr represents an equals expression
func (*EqualsExpr) Rewrite ¶
func (e *EqualsExpr) Rewrite() string
Rewrite rewrites the equals expr after parse
func (*EqualsExpr) TagKey ¶
func (e *EqualsExpr) TagKey() string
TagKey returns the equals filter's tag key
type Expr ¶
type Expr interface { // Rewrite rewrites the expr after parse Rewrite() string }
Expr represents a interface for all expression types
type FieldExpr ¶
type FieldExpr struct {
Name string `json:"name"`
}
FieldExpr represents a field name for select list
type LikeExpr ¶
LikeExpr represents a like expression
type Limit ¶ added in v0.2.4
type Limit struct { Type LimitOpType Limit string }
Limit represents limit statement.
func (*Limit) StatementType ¶ added in v0.2.4
func (q *Limit) StatementType() StatementType
StatementType returns limit type.
type LimitOpType ¶ added in v0.2.4
type LimitOpType int
const ( SetLimit LimitOpType = iota + 1 ShowLimit )
type Metadata ¶
type Metadata struct { MetadataType MetadataType Type string // root/broker/master/storage will be used. Source SourceType // source(from state repo or state manager). ClusterName string // storage/broker will be used. }
Metadata represent show metadata lin query language.
func (*Metadata) StatementType ¶
func (m *Metadata) StatementType() StatementType
StatementType returns metadata lin query language statement type.
type MetadataType ¶
type MetadataType int
MetadataType represents metadata type.
const ( // MetadataTypes represents all metadata types. MetadataTypes MetadataType = iota + 1 // BrokerMetadata represent broker metadata. BrokerMetadata // MasterMetadata represent master metadata. MasterMetadata // StorageMetadata represent storage metadata. StorageMetadata // RootMetadata represent root metadata. RootMetadata )
type MetricMetadata ¶
type MetricMetadata struct { Namespace string // namespace MetricName string // like table name Type MetricMetadataType // metadata suggest type TagKey string Prefix string Condition Expr // tag filter condition expression Limit int // result set limit }
MetricMetadata represents search metric metadata statement
func (*MetricMetadata) MarshalJSON ¶
func (q *MetricMetadata) MarshalJSON() ([]byte, error)
MarshalJSON returns json data of query
func (*MetricMetadata) StatementType ¶
func (q *MetricMetadata) StatementType() StatementType
StatementType returns metadata query type.
func (*MetricMetadata) UnmarshalJSON ¶
func (q *MetricMetadata) UnmarshalJSON(value []byte) error
UnmarshalJSON parses json data to metadata
type MetricMetadataType ¶
type MetricMetadataType uint8
MetricMetadataType represents metric metadata suggest type
const ( Namespace MetricMetadataType = iota + 1 Metric TagKey TagValue Field )
Defines all types of metric metadata suggest
func (MetricMetadataType) String ¶
func (m MetricMetadataType) String() string
String returns string value of metadata type
type NumberLiteral ¶
type NumberLiteral struct {
Val float64 `json:"val"`
}
NumberLiteral represents a number.
func (*NumberLiteral) Rewrite ¶
func (e *NumberLiteral) Rewrite() string
Rewrite rewrites the number literal after parse
type OrderByExpr ¶
type OrderByExpr struct { Expr Expr // support field name/function for select field item. Desc bool }
OrderByExpr represents order by expr item.
func (*OrderByExpr) Rewrite ¶
func (e *OrderByExpr) Rewrite() string
Rewrite rewrites the order by expr after parse
type ParenExpr ¶
type ParenExpr struct {
Expr Expr
}
ParenExpr represents a parenthesized expression
type Query ¶
type Query struct { Explain bool // need explain query execute stat Namespace string // namespace MetricName string // like table name SelectItems []Expr // select list, such as field, function call, math expression etc. AllFields bool // select all fields under metric Condition Expr // tag filter condition expression // broker plan maybe reset TimeRange timeutil.TimeRange // query time range Interval timeutil.Interval // down sampling storage interval StorageInterval timeutil.Interval // down sampling storage interval, data find IntervalRatio int // down sampling interval ratio(query interval/storage Interval) AutoGroupByTime bool // auto fix group by interval based on query time range GroupBy []string // group by tag keys OrderByItems []Expr // order by field expr list Limit int // num. of time series list for result }
Query represents search statement
func (*Query) HasGroupBy ¶
HasGroupBy returns whether query has grouping tag keys
func (*Query) MarshalJSON ¶
MarshalJSON returns json data of query
func (*Query) StatementType ¶
func (q *Query) StatementType() StatementType
StatementType returns metric query type.
func (*Query) UnmarshalJSON ¶
UnmarshalJSON parses json data to query
type RegexExpr ¶
RegexExpr represents a regular expression
type Request ¶
type Request struct {
RequestID string
}
Request represents show request statement.
func (*Request) StatementType ¶
func (q *Request) StatementType() StatementType
StatementType returns request statement type.
type Schema ¶
type Schema struct { Type SchemaType // create stmt: value is database json config. // drop stmt: value is database name. Value string }
Schema represents show all database schemas statement.
func (*Schema) StatementType ¶
func (q *Schema) StatementType() StatementType
StatementType returns schema query type.
type SchemaType ¶
type SchemaType int
const ( DatabaseNameSchemaType SchemaType = iota + 1 DatabaseSchemaType CreateDatabaseSchemaType DropDatabaseSchemaType )
type SelectItem ¶
SelectItem represents a select item from select statement
func (*SelectItem) Rewrite ¶
func (e *SelectItem) Rewrite() string
Rewrite rewrites the select item expr after parse
type State ¶
State represents show state statement.
func (*State) StatementType ¶
func (q *State) StatementType() StatementType
StatementType returns state query type.
type StateType ¶
type StateType uint8
StateType represents state statement type.
const ( // Master represents show master statement. Master StateType = iota + 1 // RootAlive represents show root alive(node) statement. RootAlive // BrokerAlive represents show broker alive(node) statement. BrokerAlive // StorageAlive represents show storage alive(node) statement. StorageAlive // Replication represents show replication statement. Replication // RootMetric represents show current root's metric statement RootMetric // BrokerMetric represents show current broker's metric statement BrokerMetric // StorageMetric represents show current storage's metric statement StorageMetric // MemoryDatabase represents show memory database statement. MemoryDatabase )
type Statement ¶
type Statement interface { // StatementType returns statement type. StatementType() StatementType }
Statement represents LinDB query language statement
type StatementType ¶
type StatementType int
const ( UseStatement StatementType = iota + 1 MetadataStatement SchemaStatement StorageStatement StateStatement MetricMetadataStatement QueryStatement RequestStatement BrokerStatement LimitStatement )
type Storage ¶
type Storage struct { Type StorageOpType Value string }
Storage represent storage statement.
func (*Storage) StatementType ¶
func (q *Storage) StatementType() StatementType
StatementType returns storage query type.
type StorageOpType ¶
type StorageOpType int
StorageOpType represents storage related operation.
const ( // StorageOpUnknown represents unknown operation. StorageOpUnknown StorageOpType = iota // StorageOpCreate represents create storage. StorageOpCreate // StorageOpShow represent show storage. StorageOpShow // StorageOpDelete represents delete storage. StorageOpDelete // StorageOpRecover represents recover storage metadata. StorageOpRecover )
type Use ¶
type Use struct {
Name string
}
Use represents use statement.
func (*Use) StatementType ¶
func (q *Use) StatementType() StatementType
StatementType returns use query type.