Documentation ¶
Overview ¶
Package lazy is a package to expose lazily computed values. The concepts and code are heavily influenced by https://cs.opensource.google/go/go/+/go1.19:src/sync/once.go.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Lazy ¶
type Lazy[T any] interface { // Get returns the value, computing it if necessary. Get() (T, error) }
Lazy represents a value whose computation is deferred until the first access
func New ¶
New returns a new lazily computed value. The value is guaranteed to only be computed a single time.
func NewWithRetry ¶
NewWithRetry returns a new lazily computed value. The value will be computed on each call until a non-nil error is returned.
Click to show internal directories.
Click to hide internal directories.