model

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2020 License: Apache-2.0 Imports: 21 Imported by: 22

Documentation

Index

Constants

View Source
const (
	FLAG_SEND = iota
	FLAG_CALLBACK
	FLAG_MASK
	FLAG_CONVERGE
	FLAG_NONEUSER
	FLAG_UPGRADE
)

0 0 0 0 0 0 处理中 0 0 0 0 x 1 已发送 0 0 0 0 1 x 已回调 0 0 0 1 0 0 已屏蔽 0 0 1 0 0 0 被收敛 0 1 0 0 x 0 无接收人 1 0 0 0 x 0 升级发送

View Source
const (
	STATUS_DOING    = "doing"     // 处理中
	STATUS_SEND     = "send"      // 已发送
	STATUS_NONEUSER = "none-user" // 无接收人
	STATUS_CALLBACK = "callback"  // 已回调
	STATUS_MASK     = "mask"      // 已屏蔽
	STATUS_CONVERGE = "converge"  // 频率限制
	STATUS_UPGRADE  = "upgrade"   // 升级报警
)

Variables

View Source
var DB = map[string]*xorm.Engine{}
View Source
var MathOperators = map[string]bool{
	">":  true,
	"<":  true,
	">=": true,
	"<=": true,
	"!=": true,
	"=":  true,
}

Functions

func AlertUpgradeMarshal

func AlertUpgradeMarshal(alterUpgrade AlertUpgrade) (string, error)

func CleanExpireMask

func CleanExpireMask(now int64) error

func CreateCollect

func CreateCollect(collectType, creator string, collect interface{}) error

func DelById

func DelById(id int64) error

func DelEventCurOlder

func DelEventCurOlder(ts int64, batch int) (int64, error)

func DelEventOlder

func DelEventOlder(ts int64, batch int) (int64, error)

func DeleteCollectById

func DeleteCollectById(collectType, creator string, cid int64) error

func EndpointBindingsForMail

func EndpointBindingsForMail(endpoints []string) []string

EndpointBindingsForMail 用来发告警邮件的时候带上各个endpoint的挂载信息

func EndpointDel

func EndpointDel(ids []int64) error

func EndpointIdsByIdents

func EndpointIdsByIdents(idents []string) ([]int64, error)

func EndpointIdsByNodeIds

func EndpointIdsByNodeIds(nodeIds []int64) ([]int64, error)

func EndpointImport

func EndpointImport(endpoints []string) error

func EndpointTotal

func EndpointTotal(query, batch, field string) (int64, error)

func EndpointUnderNodeTotal

func EndpointUnderNodeTotal(leafids []int64, query, batch, field string) (int64, error)

func EventAlertUpgradeMarshal

func EventAlertUpgradeMarshal(alertUpgrade AlertUpgrade) (string, error)

func EventCnt

func EventCnt(hashid uint64, stime, etime string, isUpgrade bool) (int64, error)

func EventCurDel

func EventCurDel(hashid uint64) error

func EventCurTotal

func EventCurTotal(stime, etime int64, nodePath, query string, priorities, sendTypes []string) (int64, error)

func EventTotal

func EventTotal(stime, etime int64, nodePath, query, eventType string, priorities, sendTypes []string) (int64, error)

func GetCollectById

func GetCollectById(collectType string, cid int64) (interface{}, error)

func GetCollectByName

func GetCollectByName(collectType string, name string) (interface{}, error)

func GetCollectByNid

func GetCollectByNid(collectType string, nids []int64) ([]interface{}, error)

func GetCollectsModel

func GetCollectsModel(t string) (interface{}, error)

func GetFlagsByStatus

func GetFlagsByStatus(ss []string) []uint16

func GetStatus

func GetStatus(status string) int

func GetStatusByFlag

func GetStatusByFlag(flag uint16) []string

func InitMySQL

func InitMySQL(names ...string)

func InitNode

func InitNode()

InitNode 初始化第一个node节点

func InitRoot

func InitRoot()

func InviteAdd

func InviteAdd(token, creator string) error

func LdapLogin

func LdapLogin(user, pass string) error

func MaskconfDel

func MaskconfDel(id int64) error

func NodeEndpointBind

func NodeEndpointBind(nid, eid int64) error

func NodeEndpointUnbind

func NodeEndpointUnbind(nid, eid int64) error

func NodeIdsGetByEndpointId

func NodeIdsGetByEndpointId(endpointId int64) ([]int64, error)

func NodeValid

func NodeValid(name, path string) error

func ParseEtime

func ParseEtime(etime int64) string

func PassLogin

func PassLogin(user, pass string) error

func Paths

func Paths(longPath string) []string

func SaveEvent

func SaveEvent(event *Event) error

func SaveEventCur

func SaveEventCur(eventCur *EventCur) error

func SaveEventCurStatus

func SaveEventCurStatus(hashid uint64, status string) error

func SaveEventStatus

func SaveEventStatus(id int64, status string) error

func SaveStraCommit

func SaveStraCommit(id int64, action, username, body string, session *xorm.Session) error

func StatusConvert

func StatusConvert(s []string) []string

func StraDel

func StraDel(id int64) error

func TeamAdd

func TeamAdd(ident, name string, mgmt int, admins, members []int64) error

func TeamNameGetsByIds

func TeamNameGetsByIds(ids string) ([]string, error)

func TeamTotal

func TeamTotal(query string) (int64, error)

func UpdateClaimantsById

func UpdateClaimantsById(userId, id int64) error

func UpdateClaimantsByNodePath

func UpdateClaimantsByNodePath(userId int64, nodePath string) error

func UpdateEventCurPriority

func UpdateEventCurPriority(hashid uint64, priority int) error

func UpdateEventPriority

func UpdateEventPriority(id int64, priority int) error

func UserIdGetByTeamIds

func UserIdGetByTeamIds(teamIds []int64) ([]int64, error)

func UserNameGetByIds

func UserNameGetByIds(ids string) ([]string, error)

func UserTotal

func UserTotal(query string) (int64, error)

Types

type AlertUpgrade

type AlertUpgrade struct {
	Users    []int64 `json:"users"`
	Groups   []int64 `json:"groups"`
	Duration int     `json:"duration"`
	Level    int     `json:"level"`
}

func AlertUpgradeUnMarshal

func AlertUpgradeUnMarshal(str string) (AlertUpgrade, error)

type Chart

type Chart struct {
	Id         int64  `json:"id"`
	SubclassId int64  `json:"subclass_id"`
	Configs    string `json:"configs"`
	Weight     int    `json:"weight"`
}

func ChartGet

func ChartGet(col string, val interface{}) (*Chart, error)

func ChartGets

func ChartGets(subclassId int64) ([]Chart, error)

func (*Chart) Add

func (c *Chart) Add() error

func (*Chart) Del

func (c *Chart) Del() error

func (*Chart) Update

func (c *Chart) Update(cols ...string) error

type Collect

type Collect struct {
	sync.RWMutex
	Ports map[int]*PortCollect    `json:"ports"`
	Procs map[string]*ProcCollect `json:"procs"`
	Logs  map[string]*LogCollect  `json:"logs"`
}

func NewCollect

func NewCollect() *Collect

func (*Collect) GetLogConfig

func (c *Collect) GetLogConfig() map[string]*LogCollect

func (*Collect) GetPorts

func (c *Collect) GetPorts() map[int]*PortCollect

func (*Collect) GetProcs

func (c *Collect) GetProcs() map[string]*ProcCollect

func (*Collect) Update

func (c *Collect) Update(cc *Collect)

type CollectHist

type CollectHist struct {
	Id          int64     `json:"id"`
	Cid         int64     `json:"cid"`
	CollectType string    `json:"collect_type"`
	Action      string    `json:"action"`
	Body        string    `json:"body"`
	Creator     string    `json:"creator"`
	Created     time.Time `xorm:"created" json:"created"`
}

type Endpoint

type Endpoint struct {
	Id    int64  `json:"id"`
	Ident string `json:"ident"`
	Alias string `json:"alias"`
}

func EndpointGet

func EndpointGet(col string, val interface{}) (*Endpoint, error)

func EndpointGets

func EndpointGets(query, batch, field string, limit, offset int) ([]Endpoint, error)

func EndpointUnderLeafs

func EndpointUnderLeafs(leafIds []int64) ([]Endpoint, error)

func EndpointUnderNodeGets

func EndpointUnderNodeGets(leafids []int64, query, batch, field string, limit, offset int) ([]Endpoint, error)

func (*Endpoint) Update

func (e *Endpoint) Update(cols ...string) error

type EndpointBinding

type EndpointBinding struct {
	Ident string `json:"ident"`
	Alias string `json:"alias"`
	Nodes []Node `json:"nodes"`
}

func EndpointBindings

func EndpointBindings(endpointIds []int64) ([]EndpointBinding, error)

type Event

type Event struct {
	Id            int64     `json:"id"`
	Sid           int64     `json:"sid"`
	Sname         string    `json:"sname"`
	NodePath      string    `json:"node_path"`
	Endpoint      string    `json:"endpoint"`
	EndpointAlias string    `json:"endpoint_alias"`
	Priority      int       `json:"priority"`
	EventType     string    `json:"event_type"` // alert|recovery
	Category      int       `json:"category"`
	Status        uint16    `json:"status"`
	HashId        uint64    `json:"hashid"  xorm:"hashid"`
	Etime         int64     `json:"etime"`
	Value         string    `json:"value"`
	Info          string    `json:"info"`
	Created       time.Time `json:"created" xorm:"created"`
	Detail        string    `json:"detail"`
	Users         string    `json:"users"`
	Groups        string    `json:"groups"`
	Nid           int64     `json:"nid"`
	NeedUpgrade   int       `json:"need_upgrade"`
	AlertUpgrade  string    `json:"alert_upgrade"`
	RecvUserIDs   []int64   `json:"recv_user_ids" xorm:"-"`
	RecvUserObjs  []User    `json:"recv_user_objs" xorm:"-"`
	RealUpgrade   bool      `json:"real_upgrade" xorm:"-"`
}

func EventGet

func EventGet(col string, value interface{}) (*Event, error)

func EventGets

func EventGets(stime, etime int64, nodePath, query, eventType string, priorities, sendTypes []string, limit, offset int) ([]Event, error)

func (*Event) GetEventDetail

func (e *Event) GetEventDetail() ([]EventDetail, error)

type EventAlertUpgrade

type EventAlertUpgrade struct {
	Users    string `json:"users"`
	Groups   string `json:"groups"`
	Duration int    `json:"duration"`
	Level    int    `json:"level"`
}

func EventAlertUpgradeUnMarshal

func EventAlertUpgradeUnMarshal(str string) (EventAlertUpgrade, error)

type EventCur

type EventCur struct {
	Id            int64     `json:"id"`
	Sid           int64     `json:"sid"`
	Sname         string    `json:"sname"`
	NodePath      string    `json:"node_path"`
	Endpoint      string    `json:"endpoint"`
	EndpointAlias string    `json:"endpoint_alias"`
	Priority      int       `json:"priority"`
	EventType     string    `json:"event_type"` // alert|recovery
	Category      int       `json:"category"`
	Status        uint16    `json:"status"`
	HashId        uint64    `json:"hashid"  xorm:"hashid"`
	Etime         int64     `json:"etime"`
	Value         string    `json:"value"`
	Info          string    `json:"info"`
	Created       time.Time `json:"created" xorm:"created"`
	Detail        string    `json:"detail"`
	Users         string    `json:"users"`
	Groups        string    `json:"groups"`
	Nid           int64     `json:"nid"`
	IgnoreAlert   int       `json:"ignore_alert"`
	Claimants     string    `json:"claimants"`
	NeedUpgrade   int       `json:"need_upgrade"`
	AlertUpgrade  string    `json:"alert_upgrade"`
}

func EventCurGet

func EventCurGet(col string, value interface{}) (*EventCur, error)

func EventCurGets

func EventCurGets(stime, etime int64, nodePath, query string, priorities, sendTypes []string, limit, offset int) ([]EventCur, error)

func (*EventCur) EventIgnore

func (e *EventCur) EventIgnore() error

type EventDetail

type EventDetail struct {
	Metric     string              `json:"metric"`
	Tags       map[string]string   `json:"tags"`
	Points     []*EventDetailPoint `json:"points"`
	PredPoints []*EventDetailPoint `json:"pred_points,omitempty"` // 预测值, 预测值不为空时, 现场值对应的是实际值
}

type EventDetailPoint

type EventDetailPoint struct {
	Timestamp int64   `json:"timestamp"`
	Value     float64 `json:"value"`
}

type EventSlice

type EventSlice []*Event

func (EventSlice) Len

func (e EventSlice) Len() int

func (EventSlice) Less

func (e EventSlice) Less(i, j int) bool

func (EventSlice) Swap

func (e EventSlice) Swap(i, j int)

type Exp

type Exp struct {
	Eopt      string  `json:"eopt"`
	Func      string  `json:"func"`      //all,max,min
	Metric    string  `json:"metric"`    //metric
	Params    []int   `json:"params"`    //连续n秒
	Threshold float64 `json:"threshold"` //阈值
}

type Instance

type Instance struct {
	Id       int64  `json:"id"`
	Module   string `json:"module"`
	Identity string `json:"identity"` //ip 或者 机器名
	RPCPort  string `json:"rpc_port" xorm:"rpc_port"`
	HTTPPort string `json:"http_port" xorm:"http_port"`
	TS       int64  `json:"ts" xorm:"ts"`
	Remark   string `json:"remark"`
	Active   bool   `xorm:"-" json:"active"`
}

func GetAllInstances

func GetAllInstances(mod string, alive int) ([]*Instance, error)

func GetInstanceBy

func GetInstanceBy(mod, identity, rpcPort, httpPort string) (*Instance, error)

func (*Instance) Add

func (i *Instance) Add() error

func (*Instance) Update

func (i *Instance) Update() error

type Invite

type Invite struct {
	Id      int64
	Token   string
	Expire  int64
	Creator string
}

func InviteGet

func InviteGet(col string, val interface{}) (*Invite, error)

type LogCollect

type LogCollect struct {
	Id          int64     `json:"id"`
	Nid         int64     `json:"nid"`
	CollectType string    `json:"collect_type"`
	Name        string    `json:"name"`
	TagsStr     string    `xorm:"tags" json:"-"`
	Step        int       `json:"step"`
	Comment     string    `json:"comment"`
	Creator     string    `json:"creator"`
	Created     time.Time `xorm:"updated" json:"created"`
	LastUpdator string    `xorm:"last_updator" json:"last_updator"`
	LastUpdated time.Time `xorm:"updated" json:"last_updated"`

	Tags map[string]string `xorm:"-" json:"tags"`

	FilePath   string `json:"file_path"`
	TimeFormat string `json:"time_format"`
	Pattern    string `json:"pattern"`
	Func       string `json:"func"`
	FuncType   string `json:"func_type"`
	Unit       string `json:"unit"`

	Degree    int    `json:"degree"`
	Zerofill  int    `xorm:"zero_fill" json:"zerofill"`
	Aggregate string `json:"aggregate"`

	LocalUpdated int64                     `xorm:"-" json:"-"`
	TimeReg      *regexp.Regexp            `xorm:"-" json:"-"`
	PatternReg   *regexp.Regexp            `xorm:"-" json:"-"`
	ExcludeReg   *regexp.Regexp            `xorm:"-" json:"-"`
	TagRegs      map[string]*regexp.Regexp `xorm:"-" json:"-"`
	ParseSucc    bool                      `xorm:"-" json:"-"`
}

func GetLogCollects

func GetLogCollects() ([]*LogCollect, error)

func (*LogCollect) Decode

func (l *LogCollect) Decode() error

func (*LogCollect) Encode

func (l *LogCollect) Encode() error

func (*LogCollect) Update

func (p *LogCollect) Update() error

type Maskconf

type Maskconf struct {
	Id        int64    `json:"id"`
	Nid       int64    `json:"nid"`
	NodePath  string   `json:"node_path" xorm:"-"`
	Metric    string   `json:"metric"`
	Tags      string   `json:"tags"`
	Cause     string   `json:"cause"`
	User      string   `json:"user"`
	Btime     int64    `json:"btime"`
	Etime     int64    `json:"etime"`
	Endpoints []string `json:"endpoints" xorm:"-"`
}

func MaskconfGet

func MaskconfGet(col string, value interface{}) (*Maskconf, error)

func MaskconfGetAll

func MaskconfGetAll() ([]Maskconf, error)

func MaskconfGets

func MaskconfGets(nodeId int64) ([]Maskconf, error)

func (*Maskconf) Add

func (mc *Maskconf) Add(endpoints []string) error

func (*Maskconf) FillEndpoints

func (mc *Maskconf) FillEndpoints() error

func (*Maskconf) Update

func (mc *Maskconf) Update(endpoints []string, cols ...string) error

type MaskconfEndpoints

type MaskconfEndpoints struct {
	Id       int64  `json:"id"`
	MaskId   int64  `json:"mask_id"`
	Endpoint string `json:"endpoint"`
}

type MySQLConf

type MySQLConf struct {
	Addr  string `yaml:"addr"`
	Max   int    `yaml:"max"`
	Idle  int    `yaml:"idle"`
	Debug bool   `yaml:"debug"`
}

type Node

type Node struct {
	Id   int64  `json:"id"`
	Pid  int64  `json:"pid"`
	Name string `json:"name"`
	Path string `json:"path"`
	Leaf int    `json:"leaf"`
	Note string `json:"note"`
}

func NodeByIds

func NodeByIds(ids []int64) ([]Node, error)

func NodeGet

func NodeGet(col string, val interface{}) (*Node, error)

func NodeGets

func NodeGets(where string, args ...interface{}) (nodes []Node, err error)

func NodeGetsByPaths

func NodeGetsByPaths(paths []string) ([]Node, error)

func NodeQueryPath

func NodeQueryPath(query string, limit int) (nodes []Node, err error)

func NodesGetByIds

func NodesGetByIds(ids []int64) ([]Node, error)

func TreeSearchByPath

func TreeSearchByPath(query string) (nodes []Node, err error)

func (*Node) Bind

func (n *Node) Bind(endpointIds []int64, delOld int) error

func (*Node) CreateChild

func (n *Node) CreateChild(name string, leaf int, note string) (int64, error)

func (*Node) Del

func (n *Node) Del() error

func (*Node) LeafIds

func (n *Node) LeafIds() ([]int64, error)

func (*Node) Pids

func (n *Node) Pids() ([]int64, error)

func (*Node) Rename

func (n *Node) Rename(name string) error

func (*Node) Unbind

func (n *Node) Unbind(hostIds []int64) error

type NodeEndpoint

type NodeEndpoint struct {
	NodeId     int64 `xorm:"'node_id'"`
	EndpointId int64 `xorm:"'endpoint_id'"`
}

func NodeEndpointGetByEndpointIds

func NodeEndpointGetByEndpointIds(endpointsIds []int64) ([]NodeEndpoint, error)

func NodeEndpointGetByNodeIds

func NodeEndpointGetByNodeIds(nodeIds []int64) ([]NodeEndpoint, error)

func (NodeEndpoint) TableName

func (NodeEndpoint) TableName() string

type PortCollect

type PortCollect struct {
	Id          int64     `json:"id"`
	Nid         int64     `json:"nid"`
	CollectType string    `json:"collect_type"`
	Name        string    `json:"name"`
	Tags        string    `json:"tags"`
	Step        int       `json:"step"`
	Comment     string    `json:"comment"`
	Creator     string    `json:"creator"`
	Created     time.Time `xorm:"updated" json:"created"`
	LastUpdator string    `xorm:"last_updator" json:"last_updator"`
	LastUpdated time.Time `xorm:"updated" json:"last_updated"`

	Port    int `json:"port"`
	Timeout int `json:"timeout"`
}

func GetPortCollects

func GetPortCollects() ([]*PortCollect, error)

func (*PortCollect) Update

func (p *PortCollect) Update() error

type ProcCollect

type ProcCollect struct {
	Id          int64     `json:"id"`
	Nid         int64     `json:"nid"`
	CollectType string    `json:"collect_type"`
	Name        string    `json:"name"`
	Tags        string    `json:"tags"`
	Step        int       `json:"step"`
	Comment     string    `json:"comment"`
	Creator     string    `json:"creator"`
	Created     time.Time `xorm:"updated" json:"created"`
	LastUpdator string    `xorm:"last_updator" json:"last_updator"`
	LastUpdated time.Time `xorm:"updated" json:"last_updated"`

	Target        string `json:"target"`
	CollectMethod string `json:"collect_method"`
}

func GetProcCollects

func GetProcCollects() ([]*ProcCollect, error)

func (*ProcCollect) Update

func (p *ProcCollect) Update() error

type Screen

type Screen struct {
	Id          int64     `json:"id"`
	NodeId      int64     `json:"node_id"`
	Name        string    `json:"name"`
	LastUpdator string    `json:"last_updator"`
	LastUpdated time.Time `xorm:"<-" json:"last_updated"`
}

func ScreenGet

func ScreenGet(col string, val interface{}) (*Screen, error)

func ScreenGets

func ScreenGets(nodeId int64) ([]Screen, error)

func (*Screen) Add

func (s *Screen) Add() error

func (*Screen) Del

func (s *Screen) Del() error

func (*Screen) Update

func (s *Screen) Update(cols ...string) error

type ScreenSubclass

type ScreenSubclass struct {
	Id       int64  `json:"id"`
	ScreenId int64  `json:"screen_id"`
	Name     string `json:"name"`
	Weight   int    `json:"weight"`
}

func ScreenSubclassGet

func ScreenSubclassGet(col string, val interface{}) (*ScreenSubclass, error)

func ScreenSubclassGets

func ScreenSubclassGets(screenId int64) ([]ScreenSubclass, error)

func (*ScreenSubclass) Add

func (s *ScreenSubclass) Add() error

func (*ScreenSubclass) Del

func (s *ScreenSubclass) Del() error

func (*ScreenSubclass) Update

func (s *ScreenSubclass) Update(cols ...string) error

type Stra

type Stra struct {
	Id                  int64     `json:"id"`
	Name                string    `json:"name"`
	Category            int       `json:"category"`                     //机器,非机器
	Nid                 int64     `json:"nid"`                          //服务树节点id
	ExclNidStr          string    `xorm:"excl_nid" json:"-"`            //排除的叶子节点
	AlertDur            int       `json:"alert_dur"`                    //单位秒,持续异常10分钟则产生异常event
	RecoveryDur         int       `json:"recovery_dur"`                 //单位秒,持续正常2分钟则产生恢复event,0表示立即产生恢复event
	RecoveryNotify      int       `json:"recovery_notify"`              //0 发送恢复通知 1不发送恢复通知
	ExprsStr            string    `xorm:"exprs" json:"-"`               //多个条件的监控实例需要相同,并且同时满足才产生event
	TagsStr             string    `xorm:"tags" json:"-"`                //tag过滤条件
	EnableStime         string    `json:"enable_stime"`                 //策略生效开始时间
	EnableEtime         string    `json:"enable_etime"`                 //策略生效终止时间 支持23:00-02:00
	EnableDaysOfWeekStr string    `xorm:"enable_days_of_week" json:"-"` //策略生效日期
	ConvergeStr         string    `xorm:"converge" json:"-"`            //告警通知收敛,第1个值表示收敛周期,单位秒,第2个值表示周期内允许发送告警次数
	Priority            int       `json:"priority"`
	Callback            string    `json:"callback"`
	NotifyGroupStr      string    `xorm:"notify_group" json:"-"`
	NotifyUserStr       string    `xorm:"notify_user" json:"-"`
	Creator             string    `json:"creator"`
	Created             time.Time `xorm:"created" json:"created"`
	LastUpdator         string    `xorm:"last_updator" json:"last_updator"`
	LastUpdated         time.Time `xorm:"<-" json:"last_updated"`
	NeedUpgrade         int       `xorm:"need_upgrade" json:"need_upgrade"`
	AlertUpgradeStr     string    `xorm:"alert_upgrade" json:"-"`

	ExclNid          []int64      `xorm:"-" json:"excl_nid"`
	Exprs            []Exp        `xorm:"-" json:"exprs"`
	Tags             []Tag        `xorm:"-" json:"tags"`
	EnableDaysOfWeek []int        `xorm:"-" json:"enable_days_of_week"`
	Converge         []int        `xorm:"-" json:"converge"`
	NotifyGroup      []int        `xorm:"-" json:"notify_group"`
	NotifyUser       []int        `xorm:"-" json:"notify_user"`
	LeafNids         []int64      `xorm:"-" json:"leaf_nids"` //叶子节点id
	Endpoints        []string     `xorm:"-" json:"endpoints"`
	AlertUpgrade     AlertUpgrade `xorm:"-" json:"alert_upgrade"`
	JudgeInstance    string       `xorm:"-" json:"judge_instance"`
}

func EffectiveStrasList

func EffectiveStrasList() ([]*Stra, error)

func StraGet

func StraGet(col string, val interface{}) (*Stra, error)

func StrasAll

func StrasAll() ([]*Stra, error)

func StrasList

func StrasList(name string, priority int, nid int64) ([]*Stra, error)

func (*Stra) Decode

func (s *Stra) Decode() error

func (*Stra) Encode

func (s *Stra) Encode() error

func (*Stra) HasPermssion

func (s *Stra) HasPermssion() error

func (*Stra) Save

func (s *Stra) Save() error

func (*Stra) Update

func (s *Stra) Update() error

type StraLog

type StraLog struct {
	Id      int64     `json:"id"`
	Sid     int64     `json:"sid"`
	Action  string    `json:"action"` // update|delete
	Body    string    `json:"body"`
	Creator string    `json:"creator"`
	Created time.Time `json:"created" xorm:"created"`
}

type Tag

type Tag struct {
	Tkey string   `json:"tkey"`
	Topt string   `json:"topt"`
	Tval []string `json:"tval"` //修改为数组
}

type Team

type Team struct {
	Id         int64  `json:"id"`
	Ident      string `json:"ident"`
	Name       string `json:"name"`
	Mgmt       int    `json:"mgmt"`
	AdminObjs  []User `json:"admin_objs" xorm:"-"`
	MemberObjs []User `json:"member_objs" xorm:"-"`
}

func TeamGet

func TeamGet(col string, val interface{}) (*Team, error)

func TeamGets

func TeamGets(query string, limit, offset int) ([]Team, error)

func (*Team) CheckFields

func (t *Team) CheckFields() error

func (*Team) Del

func (t *Team) Del() error

func (*Team) FillObjs

func (t *Team) FillObjs() error

func (*Team) Modify

func (t *Team) Modify(ident, name string, mgmt int, admins, members []int64) error

type TeamUser

type TeamUser struct {
	TeamId  int64 `json:"team_id" xorm:"'team_id'"`
	UserId  int64 `json:"user_id" xorm:"'user_id'"`
	IsAdmin int   `json:"is_admin" xorm:"'is_admin'"`
}

type TmpChart

type TmpChart struct {
	Id      int64  `json:"id"`
	Configs string `json:"configs"`
	Creator string `json:"creator"`
}

func TmpChartGet

func TmpChartGet(col string, val interface{}) (*TmpChart, error)

func (*TmpChart) Add

func (t *TmpChart) Add() error

type User

type User struct {
	Id       int64  `json:"id"`
	Username string `json:"username"`
	Password string `json:"-"`
	Dispname string `json:"dispname"`
	Phone    string `json:"phone"`
	Email    string `json:"email"`
	Im       string `json:"im"`
	IsRoot   int    `json:"is_root"`
}

func UserGet

func UserGet(col string, val interface{}) (*User, error)

func UserGetByIds

func UserGetByIds(ids []int64) ([]User, error)

func UserGets

func UserGets(query string, limit, offset int) ([]User, error)

func (*User) CanModifyTeam

func (u *User) CanModifyTeam(t *Team) (bool, error)

func (*User) CheckFields

func (u *User) CheckFields()

func (*User) CopyLdapAttr added in v1.0.2

func (u *User) CopyLdapAttr(sr *ldap.SearchResult)

func (*User) Del

func (u *User) Del() error

func (*User) Save

func (u *User) Save() error

func (*User) Update

func (u *User) Update(cols ...string) error

Jump to

Keyboard shortcuts

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