singleton

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: May 6, 2024 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Singleton

type Singleton[T any] struct {
	// contains filtered or unexported fields
}

Singleton[T any] provides a common structure for components,

func NewSingleton

func NewSingleton[T any]() *Singleton[T]

NewSingleton creates a new Singleton[T].

func (*Singleton[T]) Get

func (s *Singleton[T]) Get(name string, initFn func() *T) *T

Get returns the instance of the component with the given name.

Jump to

Keyboard shortcuts

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