store

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: May 15, 2024 License: Apache-2.0 Imports: 0 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 interface {
	// GetObjectStore returns a store for a specific object type.
	GetObjectStore(name string, sampleObject any) ObjectStore
}

Manager of multiple object stores that are persisted together.

type ObjectExistsError

type ObjectExistsError struct{}

ObjectExistsError represents an error caused due to an object which exists.

func (*ObjectExistsError) Error

func (e *ObjectExistsError) Error() string

type ObjectNotFoundError

type ObjectNotFoundError struct{}

ObjectNotFoundError represents an error caused due to an object which does not exist.

func (*ObjectNotFoundError) Error

func (e *ObjectNotFoundError) Error() string

type ObjectStore

type ObjectStore interface {
	// Create an object.
	// Returns ObjectExistsError if object already exists.
	Create(name string, object any) error
	// Update an object.
	// Returns ObjectNotFoundError if object does not exist.
	Update(name string, mutator func(any) any) error
	// Delete an object identified by the given name.
	Delete(name string) error
	// GetAll returns all of the objects in the store.
	GetAll() ([]any, error)
}

ObjectStore represents a persistent store of objects.

Directories

Path Synopsis
kv

Jump to

Keyboard shortcuts

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