notify

package
v0.9.3 Latest Latest
Warning

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

Go to latest
Published: Jul 19, 2025 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ListenMulti added in v0.9.0

func ListenMulti[L any, R any](ctx context.Context, nl *V[L], nr *V[R], fn func(context.Context, L, R) error) error

func MapDelete added in v0.8.0

func MapDelete[M ~map[K]T, K comparable, T any](m *V[M], k K)

func MapDeleteFunc added in v0.8.0

func MapDeleteFunc[M ~map[K]T, K comparable, T any](m *V[M], del func(K, T) bool)

func MapPut added in v0.8.0

func MapPut[M ~map[K]T, K comparable, T any](m *V[M], k K, v T)

func SliceAppend added in v0.8.0

func SliceAppend[S []T, T any](v *V[S], val T)

func SliceRemove added in v0.8.0

func SliceRemove[S []T, T comparable](v *V[S], val T)

Types

type V

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

func New

func New[T any](t T) *V[T]

func NewEmpty

func NewEmpty[T any]() *V[T]

func (*V[T]) Get

func (v *V[T]) Get(ctx context.Context, version uint64) (T, uint64, error)

func (*V[T]) GetAny

func (v *V[T]) GetAny(ctx context.Context) (T, uint64, error)

func (*V[T]) Listen

func (v *V[T]) Listen(ctx context.Context, f func(t T) error) error

func (*V[T]) Notify

func (v *V[T]) Notify(ctx context.Context) <-chan T

func (*V[T]) Peek

func (v *V[T]) Peek() (T, error)

func (*V[T]) Set

func (v *V[T]) Set(t T)

func (*V[T]) Sync

func (v *V[T]) Sync(f func())

func (*V[T]) Update

func (v *V[T]) Update(f func(t T) T)

func (*V[T]) UpdateOpt

func (v *V[T]) UpdateOpt(f func(t T) (T, bool)) bool

Jump to

Keyboard shortcuts

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