Documentation ¶
Index ¶
- Constants
- Variables
- func GetGroupName(serverType string) []string
- type CloseHandler
- type ComponentFunc
- type DeleteFallbackHandler
- type DeleteHandler
- type FallbackHandler
- type FallbackServiceFunc
- type GetFallbackHandler
- type GetHandler
- type GlobalVarObjectCache
- type Handler
- type HeadHandler
- type IComponent
- type IComponentCache
- type IComponentDB
- type IComponentGlobalVarObject
- type IComponentHandler
- type IComponentInfluxDB
- type IComponentQueue
- type IComponentRegistry
- type IContainer
- type IContainerCache
- type IContainerDB
- type IContainerInflux
- type IContainerQueue
- type IHandler
- type IServiceRegistry
- type PostFallbackHandler
- type PostHandler
- type PutFallbackHandler
- type PutHandler
- type ServiceFunc
- type ServiceRegistry
- func (s *ServiceRegistry) API(name string, h interface{}, tags ...string)
- func (s *ServiceRegistry) AddRPCTLS(platName string, cert string, key string) error
- func (s *ServiceRegistry) CRON(name string, h interface{}, tags ...string)
- func (s *ServiceRegistry) Closing(c func(c IContainer) error)
- func (s *ServiceRegistry) Customer(group string, name string, h interface{}, tags ...string)
- func (s *ServiceRegistry) Delete(name string, h interface{})
- func (s *ServiceRegistry) DeleteFallback(name string, h interface{})
- func (s *ServiceRegistry) Ext(name string, i interface{})
- func (s *ServiceRegistry) Fallback(name string, h interface{})
- func (s *ServiceRegistry) Flow(name string, h interface{}, tags ...string)
- func (s *ServiceRegistry) Get(name string, h interface{})
- func (s *ServiceRegistry) GetBalancer() map[string]*rpc.BalancerMode
- func (s *ServiceRegistry) GetClosings() []ComponentFunc
- func (s *ServiceRegistry) GetDynamicCron() chan *conf.Task
- func (s *ServiceRegistry) GetDynamicQueue() chan *conf.Queue
- func (s *ServiceRegistry) GetExt(name string) (bool, interface{})
- func (s *ServiceRegistry) GetFallback(name string, h interface{})
- func (s *ServiceRegistry) GetHandleds() []ServiceFunc
- func (s *ServiceRegistry) GetHandlings() []ServiceFunc
- func (s *ServiceRegistry) GetInitializings() []ComponentFunc
- func (s *ServiceRegistry) GetRPCTLS() map[string][]string
- func (s *ServiceRegistry) GetServices() map[string]map[string]interface{}
- func (s *ServiceRegistry) GetTags(name string) []string
- func (s *ServiceRegistry) Handled(h func(c *context.Context) (rs interface{}))
- func (s *ServiceRegistry) Handling(h func(c *context.Context) (rs interface{}))
- func (s *ServiceRegistry) Initializing(c func(c IContainer) error)
- func (s *ServiceRegistry) MQC(name string, h interface{}, tags ...string)
- func (s *ServiceRegistry) Micro(name string, h interface{}, tags ...string)
- func (s *ServiceRegistry) Post(name string, h interface{})
- func (s *ServiceRegistry) PostFallback(name string, h interface{})
- func (s *ServiceRegistry) Put(name string, h interface{})
- func (s *ServiceRegistry) PutFallback(name string, h interface{})
- func (s *ServiceRegistry) RPC(name string, h interface{}, tags ...string)
- func (s *ServiceRegistry) SetBalancer(platName string, mode int, p ...string) error
- func (s *ServiceRegistry) WS(name string, h interface{}, tags ...string)
- func (s *ServiceRegistry) Web(name string, h interface{}, tags ...string)
- type StandardCache
- func (s *StandardCache) Close() error
- func (s *StandardCache) GetCache(names ...string) (c cache.ICache, err error)
- func (s *StandardCache) GetCacheBy(tpName string, name string) (c cache.ICache, err error)
- func (s *StandardCache) GetRegularCache(names ...string) (c cache.ICache)
- func (s *StandardCache) SaveCacheObject(tpName string, name string, f func(c conf.IConf) (cache.ICache, error)) (bool, cache.ICache, error)
- type StandardComponent
- func (r *StandardComponent) AddCustomerService(service string, h interface{}, groupName string, tags ...string)
- func (r *StandardComponent) AddFallbackHandlers(f map[string]interface{})
- func (r *StandardComponent) AddRPCProxy(h interface{})
- func (r *StandardComponent) Close() error
- func (r *StandardComponent) Fallback(c *context.Context) (rs interface{})
- func (r *StandardComponent) GetCachedHandler(group string, service string) interface{}
- func (r *StandardComponent) GetComponent() IComponent
- func (r *StandardComponent) GetFallbackHandler(engine string, service string, method string) (interface{}, bool)
- func (r *StandardComponent) GetFallbackHandlers() map[string]interface{}
- func (r *StandardComponent) GetGroupServices(group ...string) []string
- func (r *StandardComponent) GetGroups(service string) []string
- func (r *StandardComponent) GetHandler(engine string, service string, method string) (interface{}, bool)
- func (m *StandardComponent) GetMeta(key string) interface{}
- func (r *StandardComponent) GetRegistryNames(groups ...string) map[string][]string
- func (r *StandardComponent) GetServices() []string
- func (r *StandardComponent) GetTags(service string) []string
- func (r *StandardComponent) Handle(c *context.Context) (rs interface{})
- func (r *StandardComponent) Handled(c *context.Context) (rs interface{})
- func (r *StandardComponent) Handling(c *context.Context) (rs interface{})
- func (r *StandardComponent) IsCustomerService(service string, group ...string) bool
- func (r *StandardComponent) LoadServices() error
- func (m *StandardComponent) SetMeta(key string, value interface{})
- type StandardDB
- func (s *StandardDB) Close() error
- func (s *StandardDB) GetDB(names ...string) (d db.IDB, err error)
- func (s *StandardDB) GetDBBy(tpName string, name string) (c db.IDB, err error)
- func (s *StandardDB) GetRegularDB(names ...string) (d db.IDB)
- func (s *StandardDB) SaveDBObject(tpName string, name string, f func(c conf.IConf) (db.IDB, error)) (bool, db.IDB, error)
- type StandardInfluxDB
- func (s *StandardInfluxDB) Close() error
- func (s *StandardInfluxDB) GetInflux(names ...string) (influxdb.IInfluxClient, error)
- func (s *StandardInfluxDB) GetInfluxBy(tpName string, name string) (c influxdb.IInfluxClient, err error)
- func (s *StandardInfluxDB) GetRegularInflux(names ...string) (c influxdb.IInfluxClient)
- func (s *StandardInfluxDB) SaveInfluxObject(tpName string, name string, ...) (bool, influxdb.IInfluxClient, error)
- type StandardQueue
- func (s *StandardQueue) Close() error
- func (s *StandardQueue) GetQueue(names ...string) (q queue.IQueue, err error)
- func (s *StandardQueue) GetQueueBy(tpName string, name string) (c queue.IQueue, err error)
- func (s *StandardQueue) GetRegularQueue(names ...string) (c queue.IQueue)
- func (s *StandardQueue) SaveQueueObject(tpName string, name string, f func(c conf.IConf) (queue.IQueue, error)) (bool, queue.IQueue, error)
Constants ¶
const ( //APIService http api 服务 APIService = "__api_" //RPCService rpc 服务 RPCService = "__rpc_" //WSService websocket流程服务 WSService = "__websocket_" //PageService 页面服务 PageService = "__page_" //MQCService mqc 服务 MQCService = "__mqc_" //CRONService cron服务 CRONService = "__cron_" //CustomerService 自定义服务 CustomerService = "__customer_" )
const CacheNameInVar = "cache"
CacheNameInVar 缓存名称在var配置中的末节点名称
const CacheTypeNameInVar = "cache"
CacheTypeNameInVar 缓存在var配置中的类型名称
const DBNameInVar = "db"
DBNameInVar DB名称在var配置中的末节点名称
const DBTypeNameInVar = "db"
DBTypeNameInVar DB在var配置中的类型名称
const InfluxDBNameInVar = "influxdb"
InfluxDBNameInVar influxdb名称在var配置中的末节点名称
const InfluxDBTypeNameInVar = "influxdb"
InfluxDBTypeNameInVar influxdb在var配置中的类型名称
const QueueNameInVar = "queue"
QueueNameInVar queue名称在var配置中的末节点名称
const QueueTypeNameInVar = "queue"
QueueTypeNameInVar queue在var配置中的类型名称
Variables ¶
var ErrNotFoundFallbackService = errors.New("未实现降级服务")
ErrNotFoundFallbackService 未找到服务
Functions ¶
func GetGroupName ¶
GetGroupName 获取分组类型[api,rpc > micro mq,cron > flow, web > page,others > customer]
Types ¶
type CloseHandler ¶
type CloseHandler interface {
Close() error
}
type ComponentFunc ¶
type ComponentFunc func(c IContainer) error
func (ComponentFunc) Handle ¶
func (h ComponentFunc) Handle(c IContainer) error
type DeleteFallbackHandler ¶
DeleteFallbackHandler context handler
type DeleteHandler ¶
type FallbackHandler ¶
FallbackHandler context handler
type FallbackServiceFunc ¶
func (FallbackServiceFunc) Fallback ¶
func (h FallbackServiceFunc) Fallback(c *context.Context) (rs interface{})
type GetFallbackHandler ¶
GetFallbackHandler context handler
type GetHandler ¶
type GlobalVarObjectCache ¶
type GlobalVarObjectCache struct { IContainer // contains filtered or unexported fields }
GlobalVarObjectCache cache
func NewGlobalVarObjectCache ¶
func NewGlobalVarObjectCache(c IContainer) *GlobalVarObjectCache
NewGlobalVarObjectCache 创建cache
func (*GlobalVarObjectCache) GetGlobalObject ¶
func (s *GlobalVarObjectCache) GetGlobalObject(tpName string, name string) (c interface{}, err error)
GetGlobalObject 获取全局对象
func (*GlobalVarObjectCache) SaveGlobalObject ¶
func (s *GlobalVarObjectCache) SaveGlobalObject(tpName string, name string, f func(c conf.IConf) (interface{}, error)) (bool, interface{}, error)
SaveGlobalObject 缓存全局对象
type HeadHandler ¶
type IComponent ¶
type IComponent interface { AddCustomerService(service string, h interface{}, groupName string, tags ...string) IsCustomerService(service string, group ...string) bool GetFallbackHandlers() map[string]interface{} AddFallbackHandlers(map[string]interface{}) LoadServices() error GetRegistryNames(groups ...string) map[string][]string GetGroupServices(group ...string) []string GetServices() []string GetGroups(service string) []string GetTags(service string) []string Fallback(c *context.Context) (rs interface{}) Handling(c *context.Context) (rs interface{}) Handled(c *context.Context) (rs interface{}) Handle(c *context.Context) interface{} GetMeta(key string) interface{} SetMeta(key string, value interface{}) Close() error }
IComponent 提供一组或多组服务的组件
type IComponentCache ¶
type IComponentCache interface { GetRegularCache(names ...string) (c cache.ICache) GetCache(names ...string) (c cache.ICache, err error) GetCacheBy(tpName string, name string) (c cache.ICache, err error) SaveCacheObject(tpName string, name string, f func(c conf.IConf) (cache.ICache, error)) (bool, cache.ICache, error) Close() error }
IComponentCache Component Cache
type IComponentDB ¶
type IComponentDB interface { GetRegularDB(names ...string) (d db.IDB) GetDB(names ...string) (d db.IDB, err error) GetDBBy(tpName string, name string) (c db.IDB, err error) SaveDBObject(tpName string, name string, f func(c conf.IConf) (db.IDB, error)) (bool, db.IDB, error) Close() error }
IComponentDB Component DB
type IComponentGlobalVarObject ¶
type IComponentGlobalVarObject interface { GetGlobalObject(tpName string, name string) (c interface{}, err error) SaveGlobalObject(tpName string, name string, f func(c conf.IConf) (interface{}, error)) (bool, interface{}, error) Close() error }
IComponentGlobalVarObject Component Cache
type IComponentHandler ¶
type IComponentHandler interface { GetServices() map[string]map[string]interface{} GetHandlings() []ServiceFunc GetHandleds() []ServiceFunc GetInitializings() []ComponentFunc GetClosings() []ComponentFunc GetTags(name string) []string GetDynamicQueue() chan *conf.Queue GetDynamicCron() chan *conf.Task GetRPCTLS() map[string][]string //GetBalancer 获取负载均衡模式 GetBalancer() map[string]*rpc.BalancerMode }
type IComponentInfluxDB ¶
type IComponentInfluxDB interface { GetRegularInflux(names ...string) (c influxdb.IInfluxClient) GetInflux(names ...string) (d influxdb.IInfluxClient, err error) GetInfluxBy(tpName string, name string) (c influxdb.IInfluxClient, err error) SaveInfluxObject(tpName string, name string, f func(c conf.IConf) (influxdb.IInfluxClient, error)) (bool, influxdb.IInfluxClient, error) Close() error }
IComponentInfluxDB Component DB
type IComponentQueue ¶
type IComponentQueue interface { GetRegularQueue(names ...string) (c queue.IQueue) GetQueue(names ...string) (q queue.IQueue, err error) GetQueueBy(tpName string, name string) (c queue.IQueue, err error) SaveQueueObject(tpName string, name string, f func(c conf.IConf) (queue.IQueue, error)) (bool, queue.IQueue, error) Close() error }
IComponentQueue Component Queue
type IComponentRegistry ¶
type IComponentRegistry interface { GetServices() map[string]map[string]interface{} GetHandlings() []ServiceFunc GetHandleds() []ServiceFunc GetInitializings() []ComponentFunc GetClosings() []ComponentFunc GetRPCTLS() map[string][]string IServiceRegistry }
type IContainer ¶
type IContainer interface { context.RPCInvoker GetComponent() IComponent conf.ISystemConf conf.IVarConf conf.IMainConf GetRegistry() registry.IRegistry GetLogger() logger.ILogging GetTags(name string) []string IContainerCache IContainerDB IContainerInflux IContainerQueue GetGlobalObject(tpName string, name string) (c interface{}, err error) SaveGlobalObject(tpName string, name string, f func(c conf.IConf) (interface{}, error)) (bool, interface{}, error) Close() error }
type IContainerCache ¶
type IContainerCache interface { GetRegularCache(names ...string) (c cache.ICache) GetCache(names ...string) (c cache.ICache, err error) GetCacheBy(tpName string, name string) (c cache.ICache, err error) SaveCacheObject(tpName string, name string, f func(c conf.IConf) (cache.ICache, error)) (bool, cache.ICache, error) }
type IContainerDB ¶
type IContainerInflux ¶
type IContainerInflux interface { GetRegularInflux(names ...string) (c influxdb.IInfluxClient) GetInflux(names ...string) (d influxdb.IInfluxClient, err error) GetInfluxBy(tpName string, name string) (c influxdb.IInfluxClient, err error) SaveInfluxObject(tpName string, name string, f func(c conf.IConf) (influxdb.IInfluxClient, error)) (bool, influxdb.IInfluxClient, error) }
type IContainerQueue ¶
type IContainerQueue interface { GetRegularQueue(names ...string) (c queue.IQueue) GetQueue(names ...string) (q queue.IQueue, err error) GetQueueBy(tpName string, name string) (c queue.IQueue, err error) SaveQueueObject(tpName string, name string, f func(c conf.IConf) (queue.IQueue, error)) (bool, queue.IQueue, error) }
type IServiceRegistry ¶
type IServiceRegistry interface { //Customer 添加自定义服务 Customer(group string, name string, h interface{}, tags ...string) //Micro 添加微服务(api,rpc) Micro(name string, h interface{}, tags ...string) //API 添加微服务 API(name string, h interface{}, tags ...string) //RPC 添加微服务 RPC(name string, h interface{}, tags ...string) //Flow 添加自动流程(mqc,cron) Flow(name string, h interface{}, tags ...string) //MQC 添加自动流程 MQC(name string, h interface{}, tags ...string) //CRON 添加自动流程 CRON(name string, h interface{}, tags ...string) //WS 添加websocket(mqc,cron) WS(name string, h interface{}, tags ...string) //Page 添加web页面服务(web) Web(name string, h interface{}, tags ...string) //Fallback 默认降级函数 Fallback(name string, h interface{}) //Get RESTful GET请求服务 Get(name string, h interface{}) //Get RESTful GET请求服务的降级服务 GetFallback(name string, h interface{}) //Post RESTful POST请求服务 Post(name string, h interface{}) //PostFallback RESTful POST请求服务的降级服务 PostFallback(name string, h interface{}) //Delete RESTful DELETE请求服务 Delete(name string, h interface{}) //DeleteFallback RESTful DELETE请求服务的降级服务 DeleteFallback(name string, h interface{}) //Put RESTful PUT请求服务 Put(name string, h interface{}) //PutFallback RESTful PUT请求服务的降级服务 PutFallback(name string, h interface{}) //Initializing 初始化 Initializing(c func(IContainer) error) //GetDynamicQueue 获取动态队列注册消息 GetDynamicQueue() chan *conf.Queue //GetDynamicCron 获取动态任务 GetDynamicCron() chan *conf.Task //Closing 关闭组件 Closing(c func(IContainer) error) //Handling 每个请求的预处理函数 Handling(h func(c *context.Context) (rs interface{})) //Handled 请求后处理函数 Handled(h func(c *context.Context) (rs interface{})) GetTags(name string) []string //AddRPCTLS 添加RPC安全认证证书 AddRPCTLS(platName string, cert string, key string) error //SetBalancer 设置平台对应的负载均衡器 platName:平台名称 mode:rpc.RoundRobin 或rpc.LocalFirst SetBalancer(platName string, mode int, p ...string) error //GetBalancer 获取负载均衡模式 GetBalancer() map[string]*rpc.BalancerMode }
IServiceRegistry 服务注册接口
type PostFallbackHandler ¶
PostFallbackHandler context handler
type PostHandler ¶
type PutFallbackHandler ¶
PutFallbackHandler context handler
type PutHandler ¶
type ServiceFunc ¶
func NewRPCCtxSerivce ¶
func NewRPCCtxSerivce(rpcServiceName string, rpcInput ...func(ctx *context.Context) interface{}) ServiceFunc
NewRPCCtxSerivce 构建RPC转发请求
func NewRPCSerivce ¶
func NewRPCSerivce(rpcServiceName string, rpcInput ...map[string]string) ServiceFunc
NewRPCSerivce 构建RPC转发请求
func (ServiceFunc) Handle ¶
func (h ServiceFunc) Handle(c *context.Context) (rs interface{})
type ServiceRegistry ¶
type ServiceRegistry struct {
// contains filtered or unexported fields
}
ServiceRegistry 服务注册组件
func NewServiceRegistry ¶
func NewServiceRegistry() *ServiceRegistry
NewServiceRegistry 创建ServiceRegistry
func (*ServiceRegistry) API ¶
func (s *ServiceRegistry) API(name string, h interface{}, tags ...string)
API http api服务
func (*ServiceRegistry) AddRPCTLS ¶
func (s *ServiceRegistry) AddRPCTLS(platName string, cert string, key string) error
AddRPCTLS 添加RPC认证证书
func (*ServiceRegistry) CRON ¶
func (s *ServiceRegistry) CRON(name string, h interface{}, tags ...string)
CRON Cron服务
func (*ServiceRegistry) Closing ¶
func (s *ServiceRegistry) Closing(c func(c IContainer) error)
Closing 关闭组件
func (*ServiceRegistry) Customer ¶
func (s *ServiceRegistry) Customer(group string, name string, h interface{}, tags ...string)
Customer 自定义服务
func (*ServiceRegistry) Delete ¶
func (s *ServiceRegistry) Delete(name string, h interface{})
Delete delete请求
func (*ServiceRegistry) DeleteFallback ¶
func (s *ServiceRegistry) DeleteFallback(name string, h interface{})
DeleteFallback delete降级请求
func (*ServiceRegistry) Fallback ¶
func (s *ServiceRegistry) Fallback(name string, h interface{})
Fallback 降级服务
func (*ServiceRegistry) Flow ¶
func (s *ServiceRegistry) Flow(name string, h interface{}, tags ...string)
Flow rpc服务
func (*ServiceRegistry) GetBalancer ¶
func (s *ServiceRegistry) GetBalancer() map[string]*rpc.BalancerMode
func (*ServiceRegistry) GetClosings ¶
func (s *ServiceRegistry) GetClosings() []ComponentFunc
func (*ServiceRegistry) GetDynamicCron ¶
func (s *ServiceRegistry) GetDynamicCron() chan *conf.Task
GetDynamicCron 获取动态cron
func (*ServiceRegistry) GetDynamicQueue ¶
func (s *ServiceRegistry) GetDynamicQueue() chan *conf.Queue
GetDynamicQueue 获取动态队列
func (*ServiceRegistry) GetExt ¶
func (s *ServiceRegistry) GetExt(name string) (bool, interface{})
GetExt 获取扩展
func (*ServiceRegistry) GetFallback ¶
func (s *ServiceRegistry) GetFallback(name string, h interface{})
GetFallback get降级请求
func (*ServiceRegistry) GetHandleds ¶
func (s *ServiceRegistry) GetHandleds() []ServiceFunc
func (*ServiceRegistry) GetHandlings ¶
func (s *ServiceRegistry) GetHandlings() []ServiceFunc
func (*ServiceRegistry) GetInitializings ¶
func (s *ServiceRegistry) GetInitializings() []ComponentFunc
func (*ServiceRegistry) GetRPCTLS ¶
func (s *ServiceRegistry) GetRPCTLS() map[string][]string
func (*ServiceRegistry) GetServices ¶
func (s *ServiceRegistry) GetServices() map[string]map[string]interface{}
func (*ServiceRegistry) GetTags ¶
func (s *ServiceRegistry) GetTags(name string) []string
func (*ServiceRegistry) Handled ¶
func (s *ServiceRegistry) Handled(h func(c *context.Context) (rs interface{}))
Handled 处理程序
func (*ServiceRegistry) Handling ¶
func (s *ServiceRegistry) Handling(h func(c *context.Context) (rs interface{}))
Handling 预处理程序
func (*ServiceRegistry) Initializing ¶
func (s *ServiceRegistry) Initializing(c func(c IContainer) error)
Initializing 初始化
func (*ServiceRegistry) MQC ¶
func (s *ServiceRegistry) MQC(name string, h interface{}, tags ...string)
MQC MQC流程服务
func (*ServiceRegistry) Micro ¶
func (s *ServiceRegistry) Micro(name string, h interface{}, tags ...string)
Micro 微服务
func (*ServiceRegistry) Post ¶
func (s *ServiceRegistry) Post(name string, h interface{})
Post post请求
func (*ServiceRegistry) PostFallback ¶
func (s *ServiceRegistry) PostFallback(name string, h interface{})
PostFallback post降级请求
func (*ServiceRegistry) PutFallback ¶
func (s *ServiceRegistry) PutFallback(name string, h interface{})
PutFallback put降级请求
func (*ServiceRegistry) RPC ¶
func (s *ServiceRegistry) RPC(name string, h interface{}, tags ...string)
RPC rpc服务
func (*ServiceRegistry) SetBalancer ¶
func (s *ServiceRegistry) SetBalancer(platName string, mode int, p ...string) error
SetBalancer 设置平台对应的负载均衡器 platName:平台名称 mode:rpc.RoundRobin 或rpc.LocalFirst
func (*ServiceRegistry) WS ¶
func (s *ServiceRegistry) WS(name string, h interface{}, tags ...string)
WS websocket服务
func (*ServiceRegistry) Web ¶
func (s *ServiceRegistry) Web(name string, h interface{}, tags ...string)
Web 页面服务
type StandardCache ¶
type StandardCache struct { IContainer // contains filtered or unexported fields }
StandardCache cache
func NewStandardCache ¶
func NewStandardCache(c IContainer, name ...string) *StandardCache
NewStandardCache 创建cache
func (*StandardCache) GetCache ¶
func (s *StandardCache) GetCache(names ...string) (c cache.ICache, err error)
GetCache 获取缓存操作对象
func (*StandardCache) GetCacheBy ¶
GetCacheBy 根据类型获取缓存数据
func (*StandardCache) GetRegularCache ¶
func (s *StandardCache) GetRegularCache(names ...string) (c cache.ICache)
GetRegularCache 获取正式的没有异常缓存实例
type StandardComponent ¶
type StandardComponent struct { HandlerCache map[string]map[string]interface{} //handler缓存 Container IContainer Name string //组件名称 Handlers map[string]interface{} //每个服务对应的处理程序 FallbackHandlers map[string]interface{} //每个服务对应的降级处理程序 Services []string //所有服务 GroupServices map[string][]string //每个分组包含的服务 ServiceGroup map[string][]string //每个服务对应的分组 ServiceTags map[string][]string //每个服务对应的页面 CloseHandler []interface{} //用于关闭所有handler // contains filtered or unexported fields }
StandardComponent 标准组件
func NewStandardComponent ¶
func NewStandardComponent(componentName string, c IContainer) *StandardComponent
NewStandardComponent 构建标准组件
func (*StandardComponent) AddCustomerService ¶
func (r *StandardComponent) AddCustomerService(service string, h interface{}, groupName string, tags ...string)
AddCustomerService 添加自定义分组服务
func (*StandardComponent) AddFallbackHandlers ¶
func (r *StandardComponent) AddFallbackHandlers(f map[string]interface{})
AddFallbackHandlers 添加降级函数
func (*StandardComponent) AddRPCProxy ¶
func (r *StandardComponent) AddRPCProxy(h interface{})
AddRPCProxy 添加RPC代理
func (*StandardComponent) Fallback ¶
func (r *StandardComponent) Fallback(c *context.Context) (rs interface{})
Fallback 降级处理
func (*StandardComponent) GetCachedHandler ¶
func (r *StandardComponent) GetCachedHandler(group string, service string) interface{}
GetCachedHandler 获取已缓存的handler
func (*StandardComponent) GetComponent ¶
func (r *StandardComponent) GetComponent() IComponent
GetComponent 获取当前组件
func (*StandardComponent) GetFallbackHandler ¶
func (r *StandardComponent) GetFallbackHandler(engine string, service string, method string) (interface{}, bool)
GetFallbackHandler 获取失败降级处理函数
func (*StandardComponent) GetFallbackHandlers ¶
func (r *StandardComponent) GetFallbackHandlers() map[string]interface{}
GetFallbackHandlers 获取fallback处理程序
func (*StandardComponent) GetGroupServices ¶
func (r *StandardComponent) GetGroupServices(group ...string) []string
GetGroupServices 根据分组获取服务
func (*StandardComponent) GetGroups ¶
func (r *StandardComponent) GetGroups(service string) []string
GetGroups 获取服务的分组列表
func (*StandardComponent) GetHandler ¶
func (r *StandardComponent) GetHandler(engine string, service string, method string) (interface{}, bool)
GetHandler 获取服务的处理函数
func (*StandardComponent) GetMeta ¶
func (m *StandardComponent) GetMeta(key string) interface{}
func (*StandardComponent) GetRegistryNames ¶
func (r *StandardComponent) GetRegistryNames(groups ...string) map[string][]string
func (*StandardComponent) GetServices ¶
func (r *StandardComponent) GetServices() []string
GetServices 获取组件提供的所有服务
func (*StandardComponent) GetTags ¶
func (r *StandardComponent) GetTags(service string) []string
GetTags 获取服务的tag列表
func (*StandardComponent) Handle ¶
func (r *StandardComponent) Handle(c *context.Context) (rs interface{})
Handle 组件服务执行
func (*StandardComponent) Handled ¶
func (r *StandardComponent) Handled(c *context.Context) (rs interface{})
Handled 每次handle执行后执行
func (*StandardComponent) Handling ¶
func (r *StandardComponent) Handling(c *context.Context) (rs interface{})
Handling 每次handle执行前执行
func (*StandardComponent) IsCustomerService ¶
func (r *StandardComponent) IsCustomerService(service string, group ...string) bool
IsCustomerService 是否是指定的分组服务
func (*StandardComponent) LoadServices ¶
func (r *StandardComponent) LoadServices() error
LoadServices 加载所有服务
func (*StandardComponent) SetMeta ¶
func (m *StandardComponent) SetMeta(key string, value interface{})
type StandardDB ¶
type StandardDB struct { IContainer // contains filtered or unexported fields }
StandardDB db
func NewStandardDB ¶
func NewStandardDB(c IContainer, name ...string) *StandardDB
NewStandardDB 创建DB
func (*StandardDB) GetDB ¶
func (s *StandardDB) GetDB(names ...string) (d db.IDB, err error)
GetDB 获取数据库操作对象
func (*StandardDB) GetRegularDB ¶
func (s *StandardDB) GetRegularDB(names ...string) (d db.IDB)
GetRegularDB 获取正式的没有异常数据库实例
type StandardInfluxDB ¶
type StandardInfluxDB struct { IContainer // contains filtered or unexported fields }
StandardInfluxDB db
func NewStandardInfluxDB ¶
func NewStandardInfluxDB(c IContainer, name ...string) *StandardInfluxDB
NewStandardInfluxDB 创建DB
func (*StandardInfluxDB) GetInflux ¶
func (s *StandardInfluxDB) GetInflux(names ...string) (influxdb.IInfluxClient, error)
GetInflux get influxdb
func (*StandardInfluxDB) GetInfluxBy ¶
func (s *StandardInfluxDB) GetInfluxBy(tpName string, name string) (c influxdb.IInfluxClient, err error)
GetInfluxBy 根据类型获取缓存数据
func (*StandardInfluxDB) GetRegularInflux ¶
func (s *StandardInfluxDB) GetRegularInflux(names ...string) (c influxdb.IInfluxClient)
GetRegularInflux 获取正式的没有异常Influx实例
func (*StandardInfluxDB) SaveInfluxObject ¶
func (s *StandardInfluxDB) SaveInfluxObject(tpName string, name string, f func(c conf.IConf) (influxdb.IInfluxClient, error)) (bool, influxdb.IInfluxClient, error)
SaveInfluxObject 缓存对象
type StandardQueue ¶
type StandardQueue struct { IContainer // contains filtered or unexported fields }
StandardQueue queue
func NewStandardQueue ¶
func NewStandardQueue(c IContainer, name ...string) *StandardQueue
NewStandardQueue 创建queue
func (*StandardQueue) GetQueue ¶
func (s *StandardQueue) GetQueue(names ...string) (q queue.IQueue, err error)
GetQueue GetQueue
func (*StandardQueue) GetQueueBy ¶
GetQueueBy 根据类型获取缓存数据
func (*StandardQueue) GetRegularQueue ¶
func (s *StandardQueue) GetRegularQueue(names ...string) (c queue.IQueue)
GetRegularQueue 获取正式的没有异常Queue实例