store

package
v4.1.3 Latest Latest
Warning

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

Go to latest
Published: Jul 10, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package store provides a thread-safe key-value store for arbitrary data.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Get

func Get[T any](store *Store, key string) (T, error)

Get is a type-safe helper function to retrieve a typed value from the store. It returns an error if the key does not exist or if the value cannot be cast to the requested type.

Types

type Store

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

Store is a thread-safe key-value store for arbitrary data.

func New

func New() *Store

New creates a new Store instance.

func (*Store) Delete added in v4.1.2

func (s *Store) Delete(key string)

Delete removes a value by key.

func (*Store) Get

func (s *Store) Get(key string) any

Get retrieves a value by key. It returns nil if the key does not exist.

func (*Store) Range

func (s *Store) Range(f func(key string, value any) bool)

Range iterates over all key-value pairs in the store. The iteration stops if the function f returns false.

func (*Store) Set

func (s *Store) Set(key string, value any)

Set stores a value with the specified key.

Jump to

Keyboard shortcuts

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