models

package
v0.0.0-...-e4b1f33 Latest Latest
Warning

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

Go to latest
Published: Dec 14, 2016 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddApp

func AddApp(m *App) (id int64, err error)

AddApp insert a new App into database and returns last inserted Id on success.

func AddDefApp

func AddDefApp(userId int)

func AddHost

func AddHost(hosts []*Host) (err error)

AddHost insert a new Host into database and returns last inserted Id on success.

func AddModule

func AddModule(m *Module) (id int64, err error)

AddModule insert a new Module into database and returns last inserted Id on success.

func AddSet

func AddSet(m *Set) (id int64, err error)

AddSet insert a new Set into database and returns last inserted Id on success.

func DelHostModule

func DelHostModule(appID int, moduleName string, hostIds []int) (num int64, err error)

移至空闲机/故障机

func DeleteApp

func DeleteApp(id int) (err error)

DeleteApp deletes App by Id and returns error if the record to be deleted doesn't exist

func DeleteHost

func DeleteHost(id int) (err error)

DeleteHost deletes Host by Id and returns error if the record to be deleted doesn't exist

func DeleteHosts

func DeleteHosts(id []int) (num int64, err error)

func DeleteModule

func DeleteModule(id int) (err error)

DeleteModule deletes Module by Id and returns error if the record to be deleted doesn't exist

func DeleteModuleByAppId

func DeleteModuleByAppId(id int) (num int64, err error)

根据集群ID删除模块

func DeleteSet

func DeleteSet(id int) (err error)

DeleteSet deletes Set by Id and returns error if the record to be deleted doesn't exist

func DeleteSetByAppId

func DeleteSetByAppId(id int) (num int64, err error)

根据业务ID删除集群

func ExistByName

func ExistByName(name string) bool

func GetAllApp

func GetAllApp(query map[string]string, fields []string, sortby []string, order []string,
	offset int64, limit int64) (ml []interface{}, err error)

GetAllApp retrieves all App matches certain condition. Returns empty list if no records exist

func GetAllHost

func GetAllHost(query map[string]interface{}, fields []string, sortby []string, order []string,
	offset int64, limit int64) (ml []interface{}, err error)

GetAllHost retrieves all Host matches certain condition. Returns empty list if no records exist

func GetAllModule

func GetAllModule(query map[string]string, fields []string, sortby []string, order []string,
	offset int64, limit int64) (ml []interface{}, err error)

GetAllModule retrieves all Module matches certain condition. Returns empty list if no records exist

func GetAllSet

func GetAllSet(query map[string]string, fields []string, sortby []string, order []string,
	offset int64, limit int64) (ml []interface{}, err error)

GetAllSet retrieves all Set matches certain condition. Returns empty list if no records exist

func GetAppTopoById

func GetAppTopoById(id int) (ml []interface{}, err error)

func GetCCModuleTree

func GetCCModuleTree(id int) (ml []interface{}, err error)

暴露的API接口要获取的数据

func GetDefAppByUserId

func GetDefAppByUserId(userId int) (info map[string]interface{}, err error)

func GetEmptyById

func GetEmptyById(id int) (info map[string]interface{}, options map[int]string, err error)

func GetHostByInnerIp

func GetHostByInnerIp(inner_ip string) bool

GetHostById retrieves Host by Id. Returns error if Id doesn't exist

func GetHostCount

func GetHostCount(id int, field string) (cnt int64, err error)

func ModHostModule

func ModHostModule(appID int, moduleID int, hostIds []int) (num int64, err error)

转移主机

func ResHostModule

func ResHostModule(ids []int, appID int) (num int64, err error)

上交主机

func UpdateAppById

func UpdateAppById(m *App) (err error)

UpdateApp updates App by Id and returns error if the record to be updated doesn't exist

func UpdateHostById

func UpdateHostById(m *Host) (err error)

UpdateHost updates Host by Id and returns error if the record to be updated doesn't exist

func UpdateHostToApp

func UpdateHostToApp(ids []int, appID int) (num int64, err error)

分配主机

func UpdateModuleById

func UpdateModuleById(m *Module) (err error)

UpdateModule updates Module by Id and returns error if the record to be updated doesn't exist

func UpdateSetById

func UpdateSetById(m *Set) (err error)

UpdateSet updates Set by Id and returns error if the record to be updated doesn't exist

func UpdateUser

func UpdateUser(user *User, fields ...string) error

Types

type App

type App struct {
	Id              int    `orm:"column(id);auto"`
	Type            int8   `orm:"column(type)"`
	ApplicationName string `orm:"column(application_name);size(255)"`
	LifeCycle       string `orm:"column(life_cycle);size(255)"`
	Level           int8   `orm:"column(level)"`
	OwnerId         int    `orm:"column(owner_id)"`
	Default         bool   `orm:"column(default);null"`
}

func GetAppById

func GetAppById(id int) (v *App, err error)

GetAppById retrieves App by Id. Returns error if Id doesn't exist

func (*App) TableName

func (t *App) TableName() string

type Host

type Host struct {
	HostID          int       `orm:"column(id);auto"`
	CreateTime      time.Time `orm:"column(create_time);type(timestamp)"`
	Model           string    `orm:"column(model);size(255);null"`
	Cpu             int       `orm:"column(cpu)"`
	Memory          int       `orm:"column(memory)"`
	HostName        string    `orm:"column(host_name);size(255);null"`
	InnerIP         string    `orm:"column(inner_ip);size(32)"`
	InnerGate       string    `orm:"column(inner_gate);size(32)"`
	InnerInterface  string    `orm:"column(inner_interface);size(32)"`
	BgpIP           string    `orm:"column(bgp_ip);size(255);null"`
	BgpGate         string    `orm:"column(bgp_gate);size(32)"`
	BgpInterface    string    `orm:"column(bgp_interface);size(32)"`
	OuterIP         string    `orm:"column(outer_ip);size(32);null"`
	OuterGate       string    `orm:"column(outer_gate);size(32)"`
	OuterInterface  string    `orm:"column(outer_interface);size(32)"`
	IloIP           string    `orm:"column(ilo_ip);size(255);null"`
	Source          int8      `orm:"column(source)"`
	ModuleID        int       `orm:"column(module_id);null"`
	ModuleName      string    `orm:"column(module_name);size(255);null"`
	SetID           int       `orm:"column(set_id);null"`
	SetName         string    `orm:"column(set_name);size(255);null"`
	ApplicationID   int       `orm:"column(application_id);null"`
	ApplicationName string    `orm:"column(application_name);size(255);null"`
	Owner           string    `orm:"column(owner);size(255);null"`
	Checked         string    `orm:"column(checked);size(255);null"`
	IsDistributed   bool      `orm:"column(is_distributed)"`
}

func GetHostById

func GetHostById(id int) (v *Host, err error)

GetHostById retrieves Host by Id. Returns error if Id doesn't exist

func (*Host) TableName

func (t *Host) TableName() string

type Module

type Module struct {
	Id            int    `orm:"column(id);auto"`
	ModuleName    string `orm:"column(module_name);size(255)"`
	Operator      int    `orm:"column(operator)"`
	BakOperator   int    `orm:"column(bak_operator)"`
	ApplicationId int    `orm:"column(application_id)"`
	Owner         int    `orm:"column(owner);null"`
	SetId         int    `orm:"column(set_id);null"`
}

func GetModuleById

func GetModuleById(id int) (v *Module, err error)

GetModuleById retrieves Module by Id. Returns error if Id doesn't exist

func (*Module) TableName

func (t *Module) TableName() string

type Set

type Set struct {
	SetID         int       `orm:"column(id);auto"`
	ApplicationID int       `orm:"column(application_id)"`
	Capacity      int       `orm:"column(capacity)"`
	ChnName       string    `orm:"column(chn_name);size(255);null"`
	CreateTime    time.Time `orm:"column(create_time);type(timestamp);null"`
	Default       bool      `orm:"column(default);null"`
	Description   string    `orm:"column(description);size(255);null"`
	EnviType      int       `orm:"column(envi_type)"`
	LastTime      time.Time `orm:"column(last_time);type(timestamp);null"`
	OpenStatus    string    `orm:"column(open_status);size(255)"`
	ParentID      int       `orm:"column(parent_id);null"`
	ServiceStatus int       `orm:"column(service_status)"`
	SetName       string    `orm:"column(set_name);size(255)"`
	Owner         int       `orm:"column(owner)"`
}

func GetDesetidByAppId

func GetDesetidByAppId(id int) (s Set, err error)

根据业务ID查询默认setId

func GetSetById

func GetSetById(id int) (v *Set, err error)

GetSetById retrieves Set by Id. Returns error if Id doesn't exist

func (*Set) TableName

func (t *Set) TableName() string

type User

type User struct {
	Id        int
	UserName  string `orm:"column(username);size(20)"`
	Password  string `orm:"column(password);size(32)"`
	Salt      string `orm:"column(salt);size(10)"`
	Email     string
	LastLogin int64
	LastIp    string
	Status    int
}

func GetUserById

func GetUserById(id int) (v *User, err error)

func GetUserByName

func GetUserByName(userName string) (v *User, err error)

func (*User) TableName

func (t *User) TableName() string

Jump to

Keyboard shortcuts

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