Documentation
¶
Index ¶
- Constants
- func TagsToString(alarm *db.Alarm, withQuote bool) string
- type ClickHouse
- func (c *ClickHouse) AlertViewCreate(viewTableName, viewSQL, cluster string) (err error)
- func (c *ClickHouse) AlertViewDrop(viewTableName, cluster string) (err error)
- func (c *ClickHouse) AlertViewGen(alarm *db.Alarm, filters []*db.AlarmFilter) (string, string, error)
- func (c *ClickHouse) Columns(database, table string, isTimeField bool) (res []*view.RespColumn, err error)
- func (c *ClickHouse) Complete(sql string) (res view.RespComplete, err error)
- func (c *ClickHouse) Count(param view.ReqQuery) (res uint64, err error)
- func (c *ClickHouse) DatabaseCreate(name, cluster string) error
- func (c *ClickHouse) Databases() ([]*view.RespDatabaseSelfBuilt, error)
- func (c *ClickHouse) DropDatabase(name string, cluster string) (err error)
- func (c *ClickHouse) GET(param view.ReqQuery, tid int) (res view.RespQuery, err error)
- func (c *ClickHouse) GroupBy(param view.ReqQuery) (res map[string]uint64)
- func (c *ClickHouse) ID() int
- func (c *ClickHouse) IndexUpdate(database db.Database, table db.Table, adds map[string]*db.Index, ...) (err error)
- func (c *ClickHouse) Prepare(res view.ReqQuery, isFilter bool) (view.ReqQuery, error)
- func (c *ClickHouse) TableCreate(did int, database db.Database, ct view.ReqTableCreate) (dStreamSQL, dDataSQL, dViewSQL, dDistributedSQL string, err error)
- func (c *ClickHouse) TableDrop(database, table, cluster string, tid int) (err error)
- func (c *ClickHouse) TimeFieldEqual(param view.ReqQuery, tid int) string
- func (c *ClickHouse) ViewDo(params bumo.Params) string
- func (c *ClickHouse) ViewSync(table db.Table, current *db.View, list []*db.View, isAddOrUpdate bool) (dViewSQL, cViewSQL string, err error)
- type Operator
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 ¶
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) 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) 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) 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
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 }
Click to show internal directories.
Click to hide internal directories.