state

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Manager

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

Manager manages state per namespace.

func NewManager

func NewManager() *Manager

NewManager creates a new state manager.

func (*Manager) ClearNamespace

func (m *Manager) ClearNamespace(namespace string)

ClearNamespace removes all state for a namespace.

func (*Manager) Delete

func (m *Manager) Delete(namespace, key string)

Delete removes a key from the namespace.

func (*Manager) Get

func (m *Manager) Get(namespace, key string) (any, bool)

Get returns the value for the given key in the namespace.

func (*Manager) GetAll

func (m *Manager) GetAll() map[string]map[string]any

GetAll returns a copy of all state (for debugging).

func (*Manager) GetNamespace

func (m *Manager) GetNamespace(namespace string) map[string]any

GetNamespace returns a copy of all state for a namespace.

func (*Manager) Increment

func (m *Manager) Increment(namespace, key string, delta float64) (float64, error)

Increment increments a numeric value in the namespace. If the key does not exist, it is initialized to delta. Returns the new value.

func (*Manager) Set

func (m *Manager) Set(namespace, key string, value any)

Set sets a key-value pair in the namespace.

Jump to

Keyboard shortcuts

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