ioc

package
v0.0.0-...-f4276bb Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2023 License: MIT Imports: 3 Imported by: 0

README

ioc的基本实现

就是实现一个对象托管容器(管理对象的一个中介)

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetController

func GetController(name string) any

func InitController

func InitController() error

对所有的对象统一执行 初始化

func InitHttpApi

func InitHttpApi(pathPrefix string, r gin.IRouter) error

对所有的对象统一执行 初始化 把所有 api handler 注册root 路由

func RegistryController

func RegistryController(obj IocObject)

托管业务实现的类

func RegistryHttpApi

func RegistryHttpApi(obj IocApi)

托管业务实现的类

func ShowApis

func ShowApis() (names []string)

打印下当前已经托管的实例的名称

func ShowConntrollers

func ShowConntrollers() (names []string)

打印下当前已经托管的实例的名称

Types

type IocApi

type IocApi interface {
	IocObject
	// 提供 业务Handler给Root路由的能力
	Registry(r gin.IRouter)
}

type IocObject

type IocObject interface {
	// 用于初始化对象
	Init() error
	// 对象的名称
	Name() string
}

Jump to

Keyboard shortcuts

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