balance.go 515 字节
Newer Older
E
eoLinker API Management 已提交
1 2
package entity

黄孟柱 已提交
3
import "github.com/eolinker/goku-api-gateway/server/driver"
E
eoLinker API Management 已提交
4

Y
Your Name 已提交
5
//Balance 负载
E
eoLinker API Management 已提交
6
type Balance struct {
Y
Your Name 已提交
7 8
	Name          string
	ServiceName   string
E
eoLinker API Management 已提交
9
	ServiceDriver string
Y
Your Name 已提交
10 11 12
	ServiceType   string
	AppName       string
	Static        string
E
eoLinker API Management 已提交
13
	StaticCluster string
Y
Your Name 已提交
14 15 16
	Desc          string
	CreateTime    string
	UpdateTime    string
E
eoLinker API Management 已提交
17 18
}

Y
Your Name 已提交
19
//Type 获取负载类型
Y
Your Name 已提交
20
func (e *Balance) Type() *Balance {
E
eoLinker API Management 已提交
21

Y
Your Name 已提交
22
	if e != nil {
E
eoLinker API Management 已提交
23

Y
Your Name 已提交
24 25
		d, has := driver.Get(e.ServiceDriver)
		if has {
E
eoLinker API Management 已提交
26 27 28 29 30
			e.ServiceType = d.Type
		}
	}

	return e
Y
Your Name 已提交
31
}