dynamic_params

package
v0.15.6 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrorInvalidBalance = errors.New("invalid balance")
)

Functions

func Keys

func Keys() []string

Keys 返回默认的balanceFactory注册器中所有已注册的key

func Register

func Register(key string, factory IDynamicFactory)

Register 注册balance工厂到默认balanceFactory注册器

Types

type IDynamicDriver

type IDynamicDriver interface {
	Name() string
	Generate(ctx http_context.IHttpContext, contentType string, args ...interface{}) (interface{}, error)
}

type IDynamicFactory

type IDynamicFactory interface {
	Create(name string, value []string) (IDynamicDriver, error)
}

func Get

func Get(key string) (IDynamicFactory, bool)

Get 从默认balanceFactory注册器中获取balance工厂

func GetFactory

func GetFactory(name string) (IDynamicFactory, error)

GetFactory 获取指定负载均衡算法工厂,若指定的不存在则返回一个已注册的工厂

type IFactoryRegister

type IFactoryRegister interface {
	RegisterFactoryByKey(key string, factory IDynamicFactory)
	GetFactoryByKey(key string) (IDynamicFactory, bool)
	Keys() []string
}

IFactoryRegister 实现了负载均衡算法工厂管理器

type Param

type Param struct {
	// contains filtered or unexported fields
}

func NewParam

func NewParam(name string, value []string) *Param

func (*Param) Generate

func (m *Param) Generate(ctx http_service.IHttpContext, contentType string, args ...interface{}) (interface{}, error)

func (*Param) Name

func (m *Param) Name() string

type ParamValue

type ParamValue struct {
	// contains filtered or unexported fields
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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