model

package
v0.2.0-rc1 Latest Latest
Warning

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

Go to latest
Published: Jul 23, 2021 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InsertCheckResult

func InsertCheckResult(ctx context.Context, db *gorm.DB, cr CheckResult) error

InsertCheckResult ...

func InsertNode

func InsertNode(ctx context.Context, db *gorm.DB, node *Node) error

InsertNode insert the node to db

func Migrate

func Migrate(db *gorm.DB)

Migrate migrate mysql db

Types

type AgentReportRequest

type AgentReportRequest struct {
	Hostname     string `json:"hostname"`
	IP           string `json:"ip"`
	AgentVersion string `json:"agent_version"`
	AgentType    int    `json:"agent_type"`
	RegionCode   string `json:"region_code"`
	RegionName   string `json:"region_name"`
	ZoneCode     string `json:"zone_code"`
	ZoneName     string `json:"zone_name"`
	Env          string `json:"env"`
}

AgentReportRequest agent status

type CheckReq

type CheckReq struct {
	CheckDatas []struct {
		Type string `json:"type"`
		Data string `json:"data"`
	} `json:"check_datas"`
}

CheckReq ...

type CheckResult

type CheckResult struct {
	gorm.Model
	NodeID int64  `gorm:"column:node_id" json:"node_id"`
	Status Status `gorm:"column:status" json:"status"`
	Count  int64  `gorm:"column:count" json:"status"`
}

CheckResult ...

func (CheckResult) TableName

func (cr CheckResult) TableName() string

TableName ...

type GetFileReq added in v0.1.0

type GetFileReq struct {
	FileName string `query:"file_name"`
}

type Node

type Node struct {
	ID         int64  `gorm:"primary_key"`
	AppName    string `gorm:"column:aname"`
	Schema     string `gorm:"column:schema"` // http / grpc
	IP         string `gorm:"column:ip"`
	Port       int32  `gorm:"column:port"`
	CreateTime *int64 `gorm:"column:ctime"`
	UpdateTime *int64 `gorm:"column:utime"`
	DeleteTime *int64 `gorm:"column:dtime"`
}

Node represents service node

func ListNodes

func ListNodes(ctx context.Context, db *gorm.DB) ([]Node, error)

ListNodes list the node infos

func (Node) String

func (n Node) String() string

String return the node string

func (Node) TableName

func (n Node) TableName() string

TableName return the db name

type PMTShell

type PMTShell struct {
	Pmt     string `json:"pmt"`
	AppName string `json:"app_name"`
	Op      int    `json:"op"`
}

PMTShell ...

type Status

type Status int

Status ...

const (
	// StatusInit ...
	StatusInit Status = 1
	// StatusSuccess ...
	StatusSuccess Status = 2
	// NodeTableName ...
	NodeTableName = "ma_node"
)

Jump to

Keyboard shortcuts

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