//
pkg.gl
Category
github.com/NumberMan1/common
ns
singleton
package
1.0.22
Repository:
https://github.com/numberman1/common.git
Documentation:
pkg.go.dev
Overview
Versions
1
Dependencies
3
Dependents
1
Files
47 SLOC
#
Functions
Get
Get returns a previously created value for the singleton, else the default value for T.
GetOrDo
GetOrDo will create and store a value in the Singleton, if one doesn't already exist, by calling the fn, else it will return the existing value.
#
Variables
ErrTypeMismatch
ErrTypeMismatch is returned when trying to get a result for some type that is different from the stored type.
#
Structs
Singleton
Singleton can store a single value atomically when used with GetOrDo.