ioc

package
v1.0.34 Latest Latest
Warning

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

Go to latest
Published: Jan 25, 2022 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package ioc 实现控制反转功能,放置循环依赖的问题。

可注册:[APP,GIN,GRPC]

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConfigAllApps

func ConfigAllApps() error

ConfigAllApps 初始化 APP 实例

func GetAllRegisterAppsNames

func GetAllRegisterAppsNames() (names []string)

GetAllRegisterAppsNames 获取注册成功的 APP

func GetAllRpcServiceAppsNames

func GetAllRpcServiceAppsNames() (names []string)

GetAllRpcServiceAppsNames 获取注册成功的 APP

func GetAllSubRouterAppsNames

func GetAllSubRouterAppsNames() (names []string)

GetAllSubRouterAppsNames 获取注册成功的 APP

func LoadAllRpcServer

func LoadAllRpcServer(rpcserver grpc.ServiceRegistrar) error

LoadAllRpcServer 加载所有 rpc 注册的服务

func LoadAllSubRouter

func LoadAllSubRouter(rootRouter *gin.RouterGroup) error

LoadAllSubRouter 加载所有子路由

func Register

func Register(instance App)

Register 注册 app 实例

func RegisterToGin

func RegisterToGin(subr SubRouter)

RegisterToGin 注册 子路由 实例

func RegisterToRpc

func RegisterToRpc(rap RpcApp)

RegisterToRpc 注册 RPC 服务

Types

type App

type App interface {
	Config() error
	Name() string
}

func GetApp

func GetApp(name string) App

GetApp 获取 app 实例

type RpcApp

type RpcApp interface {
	App
	RegisterRpc(grpc.ServiceRegistrar) error
}

type SubRouter

type SubRouter interface {
	App
	SetRouter(*gin.RouterGroup) error
}

Jump to

Keyboard shortcuts

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