framework

package
v0.0.0-...-d87d503 Latest Latest
Warning

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

Go to latest
Published: Aug 10, 2022 License: MIT Imports: 3 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 {
	// Bind a service provider if keyword exists will be replace and return error
	Bind(provider ServiceProvider) error

	// IsBind identify check service provider has been bind
	IsBind(key string) bool

	// Make service by key identify
	Make(key string) (interface{}, error)

	// Make service by key identify, if key does not bound service provider will throw panic
	// So using the interfae must be sure keep service container already assign key identify bind service provider
	MustMake(key string) interface{}

	// MakeNew get service by key identify, but is not singleton
	// New instance by service provider register boot function pass paramters
	// This function is useful when you need to start different instances for different parameters
	MakeNew(key string, params []interface{}) (interface{}, error)
}

Define container is server container Privoder bindig service

type NewInstance

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

NewInstance create all container service

type ServiceProvider

type ServiceProvider interface {
	// Register register instance on container
	Register(Container) NewInstance

	// Boot return error service instance fail
	Boot(Container) error

	// IsDefer false don't need delay initialization
	// true need delay initialization
	IsDefer() bool

	// Params define new instance paramters
	Params(Container) []interface{}

	// Name represent service identify
	Name() string
}

ServiceProvider define Service providder

type WebContainer

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

WebContainer

func NewWebContainer

func NewWebContainer() *WebContainer

NewWebContainer

func (*WebContainer) Bind

func (web *WebContainer) Bind(provider ServiceProvider) error

func (*WebContainer) IsBind

func (web *WebContainer) IsBind(key string) bool

IsBind implement

func (*WebContainer) Make

func (web *WebContainer) Make(key string) (interface{}, error)

Make

func (*WebContainer) MakeNew

func (web *WebContainer) MakeNew(key string, params []interface{}) (interface{}, error)

MakeNew

func (*WebContainer) MustMake

func (web *WebContainer) MustMake(key string) interface{}

MustMake

func (*WebContainer) PrintProviders

func (web *WebContainer) PrintProviders() []string

PrintPrivoders print registered provider key name

Directories

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

Jump to

Keyboard shortcuts

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