inquiry

package
v0.3.0-rc3 Latest Latest
Warning

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

Go to latest
Published: May 17, 2022 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ModeStandalone int = iota
	ModeCluster
)
View Source
const (
	TableCreateTypeCV    = 0
	TableCreateTypeExist = 1
)
View Source
const (
	TimeTypeString = 1
	TimeTypeFloat  = 2
)

Variables

This section is empty.

Functions

func TagsToString

func TagsToString(alarm *db.Alarm, withQuote bool) string

Types

type ClickHouse

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

func NewClickHouse

func NewClickHouse(db *sql.DB, ins *db.Instance) *ClickHouse

func (*ClickHouse) AlertViewCreate

func (c *ClickHouse) AlertViewCreate(viewTableName, viewSQL, cluster string) (err error)

func (*ClickHouse) AlertViewDrop

func (c *ClickHouse) AlertViewDrop(viewTableName, cluster string) (err error)

func (*ClickHouse) AlertViewGen

func (c *ClickHouse) AlertViewGen(alarm *db.Alarm, filters []*db.AlarmFilter) (string, string, error)

AlertViewGen TableTypePrometheusMetric: `CREATE MATERIALIZED VIEW %s TO metrics.samples AS SELECT

    toDate(_timestamp_) as date,
    %s as name,
    array(%s) as tags,
    toFloat64(count(*)) as val,
    _timestamp_ as ts,
    toDateTime(_timestamp_) as updated
FROM %s WHERE %s GROUP by _timestamp_;`,

func (*ClickHouse) Columns

func (c *ClickHouse) Columns(database, table string, isTimeField bool) (res []*view.RespColumn, err error)

func (*ClickHouse) Complete

func (c *ClickHouse) Complete(sql string) (res view.RespComplete, err error)

func (*ClickHouse) Count

func (c *ClickHouse) Count(param view.ReqQuery) (res uint64, err error)

func (*ClickHouse) DatabaseCreate

func (c *ClickHouse) DatabaseCreate(name, cluster string) error

func (*ClickHouse) Databases

func (c *ClickHouse) Databases() ([]*view.RespDatabaseSelfBuilt, error)

func (*ClickHouse) DropDatabase

func (c *ClickHouse) DropDatabase(name string, cluster string) (err error)

func (*ClickHouse) GET

func (c *ClickHouse) GET(param view.ReqQuery, tid int) (res view.RespQuery, err error)

func (*ClickHouse) GroupBy

func (c *ClickHouse) GroupBy(param view.ReqQuery) (res map[string]uint64)

func (*ClickHouse) ID

func (c *ClickHouse) ID() int

func (*ClickHouse) IndexUpdate

func (c *ClickHouse) IndexUpdate(database db.Database, table db.Table, adds map[string]*db.Index, dels map[string]*db.Index, newList map[string]*db.Index) (err error)

IndexUpdate Data table index operation

func (*ClickHouse) Prepare

func (c *ClickHouse) Prepare(res view.ReqQuery, isFilter bool) (view.ReqQuery, error)

func (*ClickHouse) TableCreate

func (c *ClickHouse) TableCreate(did int, database db.Database, ct view.ReqTableCreate) (dStreamSQL, dDataSQL, dViewSQL, dDistributedSQL string, err error)

TableCreate create default stream data table and view

func (*ClickHouse) TableDrop

func (c *ClickHouse) TableDrop(database, table, cluster string, tid int) (err error)

TableDrop data view stream

func (*ClickHouse) TimeFieldEqual

func (c *ClickHouse) TimeFieldEqual(param view.ReqQuery, tid int) string

func (*ClickHouse) ViewDo

func (c *ClickHouse) ViewDo(params bumo.Params) string

func (*ClickHouse) ViewSync

func (c *ClickHouse) ViewSync(table db.Table, current *db.View, list []*db.View, isAddOrUpdate bool) (dViewSQL, cViewSQL string, err error)

ViewSync delete: list need remove current update: list need update current create: list need add current

type Operator

type Operator interface {
	Count(view.ReqQuery) (uint64, error)
	DropDatabase(string, string) error
	AlertViewDrop(string, string) error
	DatabaseCreate(string, string) error
	GroupBy(view.ReqQuery) map[string]uint64
	Complete(string) (view.RespComplete, error)
	TableDrop(string, string, string, int) error
	AlertViewCreate(string, string, string) error
	GET(view.ReqQuery, int) (view.RespQuery, error)
	Databases() ([]*view.RespDatabaseSelfBuilt, error)
	Prepare(view.ReqQuery, bool) (view.ReqQuery, error) // Request Parameter Preprocessing
	Columns(string, string, bool) ([]*view.RespColumn, error)
	AlertViewGen(*db.Alarm, []*db.AlarmFilter) (string, string, error)
	ViewSync(db.Table, *db.View, []*db.View, bool) (string, string, error)
	TableCreate(int, db.Database, view.ReqTableCreate) (string, string, string, string, error)
	IndexUpdate(db.Database, db.Table, map[string]*db.Index, map[string]*db.Index, map[string]*db.Index) error // Data table index operation
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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