Versions in this module Expand all Collapse all v0 v0.3.1 Jan 9, 2023 Changes in this version + var ErrEmptyBalance = errors.New("balance data is empty") + var ErrEmptyKeyForHash = errors.New("hash balance key is empty") + type Balance struct + func NewBalance(addr string, port, weight int64) *Balance + func (lb *Balance) Addr() string + func (lb *Balance) CallTimes() int64 + func (lb *Balance) Port() int64 + func (lb *Balance) String() string + func (lb *Balance) Weight() int64 + type Hash struct + func (lb *Hash) DoBalance(balance []*Balance, key string) (b *Balance, err error) + type LoadBalancer interface + DoBalance func(balance []*Balance, key string) (b *Balance, err error) + type Random struct + func (lb *Random) DoBalance(balance []*Balance, key string) (b *Balance, err error) + type RoundRobin struct + func (lb *RoundRobin) DoBalance(balance []*Balance, key string) (b *Balance, err error) + type RoundRobinWeight struct + func (lb *RoundRobinWeight) DoBalance(balance []*Balance, key string) (b *Balance, err error) + type Shuffle struct + Mode int + func (lb *Shuffle) DoBalance(balance []*Balance, key string) (b *Balance, err error)