ioc

package
v0.0.0-...-f5108b3 Latest Latest
Warning

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

Go to latest
Published: Jan 8, 2024 License: MIT Imports: 2 Imported by: 0

README

对象注册表

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GinApiHandler

type GinApiHandler interface {
	Registry(r gin.IRouter)
}

Gin

type GrpcHandler

type GrpcHandler interface {
	Registry(r *grpc.Server)
}

type IocContainter

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

定义接口 就是定义逻辑 定义一个对象的注册表,IocContainter

func ApiHandler

func ApiHandler() *IocContainter

专门用于注册Controller对象

func Controller

func Controller() *IocContainter

专门用于注册Controller对象

func (*IocContainter) Get

func (c *IocContainter) Get(name string) any

func (*IocContainter) GrpcSerivceRegistry

func (c *IocContainter) GrpcSerivceRegistry(r *grpc.Server)

所有的对象(Grpc 接口实现) 通过对外通过grpc暴露

func (*IocContainter) Init

func (c *IocContainter) Init() error

负责初始化所有的对象

func (*IocContainter) Registry

func (c *IocContainter) Registry(obj IocObject)

func (*IocContainter) RouteRegistry

func (c *IocContainter) RouteRegistry(r gin.IRouter)

管理者所有的对象(Api Handler) 把每个 ApiHandler的路由注册给Root Router

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