lazy

package
v0.2.44 Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2026 License: Apache-2.0 Imports: 5 Imported by: 2 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Init

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

Init holds a graph of lazily initialized dependencies.

func New

func New() *Init

New creates a new empty Init.

func (*Init) Add

func (ini *Init) Add(initFn func() (any, error)) *Init

Add adds a func as a new child dependency.

func (*Init) Branch

func (ini *Init) Branch(initFn func() (any, error)) *Init

Branch creates a new dependency branch based on an existing and adds the given dependency as a child.

func (*Init) BranchWithTimeout

func (ini *Init) BranchWithTimeout(timeout time.Duration, f func(ctx context.Context) (any, error)) *Init

BranchdWithTimeout is same as Branch, but with a timeout.

func (*Init) Do

func (ini *Init) Do() (any, error)

Do initializes the entire dependency graph.

func (*Init) Reset

func (ini *Init) Reset()

Reset resets the current and all its dependencies.

Jump to

Keyboard shortcuts

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