minstance

package
v0.1.6 Latest Latest
Warning

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

Go to latest
Published: Jun 30, 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 is a singleton container.

func New

func New() *Container

func (*Container) All added in v0.1.2

func (c *Container) All() []any

All returns all instances.

func (*Container) Count added in v0.1.2

func (c *Container) Count() int

Count returns the number of instances.

func (*Container) Get

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

Get gets the existing instance.

func (*Container) GetOrSetFunc

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

GetOrSetFunc gets the instance, if it does not exist, it will be created by the function.

func (*Container) Remove

func (c *Container) Remove(name string)

Remove removes the instance.

func (*Container) Set

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

Set sets the instance.

Jump to

Keyboard shortcuts

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