dbmodel

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Feb 5, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddEntity

func AddEntity(entity interface{}) error

func DeleteChartAndLines

func DeleteChartAndLines(chartId uint32) error

func DeleteEntity

func DeleteEntity(entity interface{}) error

func DeleteLines

func DeleteLines(lineIds []uint32) error

func GetEntity

func GetEntity(entity interface{}) error

GetEntity query entity by id

func IsContactNameExist

func IsContactNameExist(name string) bool

func NewMySQL

func NewMySQL(c *MySQLConfig) error

func QueryAllEntity

func QueryAllEntity(entities interface{}) error

func QueryUpdateContacts

func QueryUpdateContacts(updated time.Time, contacts *[]AlarmContact) error

func QueryUpdateRules

func QueryUpdateRules(updated time.Time, rules *[]AlarmRule) error

func UpdateEntity

func UpdateEntity(entity interface{}) error

Types

type AlarmContact

type AlarmContact struct {
	Entity
	Name   string `json:"name"`
	Phone  string `json:"phone"`
	Mail   string `json:"mail"`
	Wechat string `json:"wechat"`
}

func (AlarmContact) TableName

func (AlarmContact) TableName() string

type AlarmRule

type AlarmRule struct {
	Entity
	Name       string `json:"name"`
	Type       int    `json:"type"`
	QueryRange int    `json:"query_range"`
	Contacts   string `json:"contacts"`
	Level      int    `json:"level"`
	Message    string `json:"message"`
	DataSource string `json:"data_source"`
	Trigger    string `json:"trigger"`
}

func (AlarmRule) TableName

func (AlarmRule) TableName() string

type Chart

type Chart struct {
	Entity
	DashboardId uint32 `json:"dashboard_id"`
	Name        string `json:"name"`
	Type        string `json:"type"`
	Aggregation string `json:"aggregation"`
	DownSample  string `json:"down_sample"`
	TopnLimit   int    `json:"topn_limit"`
}

func QueryDashboardCharts

func QueryDashboardCharts(dashboardId uint32) ([]Chart, error)

func (Chart) TableName

func (Chart) TableName() string

type Dashboard

type Dashboard struct {
	Entity
	Name        string `json:"name"`
	Creator     string `json:"creator"`
	AppName     string `json:"app_name"`
	ChartLayout string `json:"chart_layout"`
	TagFilter   string `json:"tag_filter"`
	SavedStatus string `json:"saved_status"`
}

func (Dashboard) TableName

func (Dashboard) TableName() string

type Entity

type Entity struct {
	ID        uint32    `json:"id"`
	Created   time.Time `json:"created"`
	Updated   time.Time `json:"updated"`
	IsDeleted int       `json:"is_deleted"`
}

Entity all MySQL tables should include these columns, embed this structure to all table entity

func (*Entity) SetTimeNow

func (p *Entity) SetTimeNow()

type Line

type Line struct {
	Entity
	ChartId uint32 `json:"chart_id"`
	Name    string `json:"name"`
	Metric  string `json:"metric"`
	Tags    string `json:"tags"`
	Offset  int    `json:"offset"`
}

func QueryChatLines

func QueryChatLines(chartId uint32) ([]Line, error)

func (Line) TableName

func (Line) TableName() string

type MetricWhiteList

type MetricWhiteList struct {
	Entity
	Metric  string `json:"metric"`
	Creator string `json:"creator"`
	AppName string `json:"app_name"`
}

func (MetricWhiteList) TableName

func (MetricWhiteList) TableName() string

type MySQLConfig

type MySQLConfig struct {
	Host     string `json:"host"`
	Port     int    `json:"port"`
	Username string `json:"username"`
	Password string `json:"password"`
	DBName   string `json:"db_name"`
}

Jump to

Keyboard shortcuts

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