lazy

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Jan 6, 2025 License: Apache-2.0 Imports: 3 Imported by: 13

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewCloserHolder

func NewCloserHolder[V io.Closer](provider func() (V, error)) *lazyHolder[V]

func NewGetter

func NewGetter[V any](provider func() (V, error)) *lazyGetter[V]

func NewHolder

func NewHolder[V any](provider func() (V, error), closer func(V) error) *lazyHolder[V]

func NewProvider

func NewProvider[K comparable, V any](provider func(K) (V, error)) *lazyProvider[K, K, V]

func NewProviderWithKeyMapper

func NewProviderWithKeyMapper[I any, K comparable, V any](keyMapper func(I) K, provider func(I) (V, error)) *lazyProvider[I, K, V]

Types

type Getter

type Getter[V any] interface {
	Get() (V, error)
}

type Holder

type Holder[V any] interface {
	Get() (V, error)
	Reset() error
}

type Provider

type Provider[I any, V any] interface {
	Get(I) (V, error)
	Peek(input I) (V, bool)
	Update(I) (V, V, error)
	Delete(I) (V, bool)
	Length() int
}

Jump to

Keyboard shortcuts

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