genericstore

package module
v0.75.2 Latest Latest
Warning

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

Go to latest
Published: Feb 3, 2026 License: Apache-2.0 Imports: 1 Imported by: 1

Documentation

Overview

Package genericstore defines a generic object store that satisfies a redundant use-case in the tagger component implementation. The implementation of the tagger component requires storing objects indexed by keys. Keys are in the form of `{prefix}://{id}`.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ObjectStore added in v0.74.0

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

ObjectStore is a generic store that can store objects indexed by keys.

func NewObjectStore

func NewObjectStore[T any]() *ObjectStore[T]

NewObjectStore creates a new ObjectStore.

func (*ObjectStore[T]) ForEach added in v0.74.0

func (os *ObjectStore[T]) ForEach(filter *types.Filter, apply types.ApplyFunc[T])

ForEach applies the provided function to each object in the store matching the filter.

func (*ObjectStore[T]) Get added in v0.74.0

func (os *ObjectStore[T]) Get(entityID types.EntityID) (object T, found bool)

Get returns the object with the specified entity ID if it exists in the store.

func (*ObjectStore[T]) ListObjects added in v0.74.0

func (os *ObjectStore[T]) ListObjects(filter *types.Filter) []T

ListObjects returns every object in the store matching the provided filter.

func (*ObjectStore[T]) Set added in v0.74.0

func (os *ObjectStore[T]) Set(entityID types.EntityID, object T)

Set stores the provided object under the specified entity ID.

func (*ObjectStore[T]) Size added in v0.74.0

func (os *ObjectStore[T]) Size() int

Size returns the total number of objects in the store.

func (*ObjectStore[T]) Unset added in v0.74.0

func (os *ObjectStore[T]) Unset(entityID types.EntityID)

Unset removes the object associated with the specified entity ID.

Jump to

Keyboard shortcuts

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