framework

package
v0.0.0-...-1922761 Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2023 License: MIT Imports: 0 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Container

type Container interface {
	//绑定服务提供者provider,存在时替换
	Bind(provider ServiceProvider) error
	//判断是否已绑定
	IsBind(key string) bool

	//根据凭证获取服务
	Make(key string) (interface{}, error)
	//获取服务,不返回error,不存在提供者时panic
	MustMake(key string) interface{}
	//为不同参数提供不同实例
	MakeNew(key string, params []interface{}) (interface{}, error)
}

服务容器

type JwContainer

type JwContainer struct {
	Container
	// contains filtered or unexported fields
}

type NewInstance

type NewInstance func(...interface{}) (interface{}, error)

type ServiceProvider

type ServiceProvider interface {
	//注册服务
	Register(Container) NewInstance
	//实例化服务
	Boot(Container) error
	//是否延迟实例化
	IsDefer() bool
	//获取参数
	Params(Container) []interface{}
	//服务凭证
	Name() string
}

一个服务提供者需要实现的接口

Directories

Path Synopsis
gin
Package gin implements a HTTP web framework called gin.
Package gin implements a HTTP web framework called gin.

Jump to

Keyboard shortcuts

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