ioc

package
v0.0.0-...-8edd8d8 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2023 License: MIT Imports: 2 Imported by: 0

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)
}

grpc

type IocContainter

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

定义一个接口 --- 对象注册表

func ApiHandler

func ApiHandler() *IocContainter

专门用于注册Controller对象

func Controller

func Controller() *IocContainter

专门用于注册Controller对象

func (*IocContainter) Get

func (i *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 (i *IocContainter) Registry(obj IocObject)

func (*IocContainter) RouteRegistry

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

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

type IocObject

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

定义注册进来的对象的约束条件

Jump to

Keyboard shortcuts

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