minstance

package
v0.0.0-...-961d35a Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2025 License: MIT Imports: 1 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 struct {
	// contains filtered or unexported fields
}

Container 单例容器

func New

func New() *Container

func (*Container) Get

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

Get 获取已存在的实例

func (*Container) GetOrSetFunc

func (c *Container) GetOrSetFunc(name string, fn func() any) any

GetOrSetFunc 获取实例,如果不存在则通过函数创建

func (*Container) Remove

func (c *Container) Remove(name string)

Remove 移除实例

func (*Container) Set

func (c *Container) Set(name string, instance any)

Set 设置实例

Jump to

Keyboard shortcuts

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