lazy_init

package
v2.8.24 Latest Latest
Warning

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

Go to latest
Published: Feb 23, 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 LazyInit

type LazyInit struct {
	// contains filtered or unexported fields
}

LazyInit is lazy value initialization type. It helps construct object on access and only once.

func NewLazyInit

func NewLazyInit(constructor func() (interface{}, error)) *LazyInit

NewLazyInit creates a new lazy initialization variable. It takes a constructor function to make an object.

func (*LazyInit) GetValue

func (l *LazyInit) GetValue() (interface{}, error)

GetValue returns initialized value or error if something wrong happened.

Jump to

Keyboard shortcuts

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