store

package
v0.1.44 Latest Latest
Warning

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

Go to latest
Published: Jan 7, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MustRemember

func MustRemember[T any](c state.SupportState, key string, calc func() T) T

func Remember

func Remember[T any](c state.SupportState, key string, calc func() T) (T, error)

func RememberUnsafe

func RememberUnsafe[T any](c state.SupportState, key string, calc func() T) T

Types

type MutableValue

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

MutableValue is a trivial state container.

func NewMutableValue

func NewMutableValue(initial any, changeNotifier func(any), compare func(any, any) bool) *MutableValue

func (*MutableValue) Get

func (mv *MutableValue) Get() any

func (*MutableValue) Set

func (mv *MutableValue) Set(value any)

type MutableValueInterface

type MutableValueInterface = state.MutableValue

type MutableValueTyped

type MutableValueTyped[T any] struct {
	// contains filtered or unexported fields
}

func NewMutableValueTyped

func NewMutableValueTyped[T any](initial T, changeNotifier func(T), compare func(T, T) bool) *MutableValueTyped[T]

type MutableValueTypedWrapper

type MutableValueTypedWrapper[T any] struct {
	// contains filtered or unexported fields
}

func (*MutableValueTypedWrapper[T]) Get

func (w *MutableValueTypedWrapper[T]) Get() T

func (*MutableValueTypedWrapper[T]) Set

func (w *MutableValueTypedWrapper[T]) Set(value T)

func (*MutableValueTypedWrapper[T]) Unwrap

type PersistentState

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

func (*PersistentState) GetState

func (ps *PersistentState) GetState(id string, initial func() any) MutableValueInterface

func (*PersistentState) SetOnStateChange

func (ps *PersistentState) SetOnStateChange(callback func())

type PersistentStateInterface

type PersistentStateInterface = state.PersistentState

type TypedMutableValueInterface

type TypedMutableValueInterface[T any] = state.TypedMutableValue[T]

func MustState

func MustState[T any](c state.SupportState, key string, initial func() T) TypedMutableValueInterface[T]

func State

func State[T any](c state.SupportState, key string, initial func() T) (TypedMutableValueInterface[T], error)

func StateUnsafe

func StateUnsafe[T any](c state.SupportState, key string, initial func() T) TypedMutableValueInterface[T]

func WrapMutableValue

func WrapMutableValue[T any](mv *MutableValue) (TypedMutableValueInterface[T], error)

Jump to

Keyboard shortcuts

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