storage

package
v0.21.1 Latest Latest
Warning

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

Go to latest
Published: Sep 18, 2025 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrKeyNotFound   = errors.New("key not found")
	ErrStorageClosed = errors.New("storage is closed")
	ErrInvalidKey    = errors.New("invalid key")
	ErrInvalidValue  = errors.New("invalid value")
)

Common storage errors

Functions

This section is empty.

Types

type MemoryStorage

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

MemoryStorage is a simple in-memory storage implementation for testing.

func NewMemoryStorage

func NewMemoryStorage() *MemoryStorage

NewMemoryStorage creates a new in-memory storage backend.

func (*MemoryStorage) Close

func (m *MemoryStorage) Close() error

func (*MemoryStorage) Delete

func (m *MemoryStorage) Delete(ctx context.Context, key string) error

func (*MemoryStorage) Exists

func (m *MemoryStorage) Exists(ctx context.Context, key string) (bool, error)

func (*MemoryStorage) Get

func (m *MemoryStorage) Get(ctx context.Context, key string) ([]byte, error)

func (*MemoryStorage) Put

func (m *MemoryStorage) Put(ctx context.Context, key string, value []byte) error

type Storage

type Storage interface {
	// Get retrieves data for the given key.
	Get(ctx context.Context, key string) ([]byte, error)

	// Put stores data for the given key.
	Put(ctx context.Context, key string, value []byte) error

	// Delete removes the data for the given key.
	Delete(ctx context.Context, key string) error

	// Exists checks if a key exists in storage.
	Exists(ctx context.Context, key string) (bool, error)

	// Close closes the storage backend.
	Close() error
}

Storage defines the interface for storage backends.

Directories

Path Synopsis
Package postgres provides a PostgreSQL implementation of the go-sync-kit EventStore with real-time LISTEN/NOTIFY capabilities for event streaming.
Package postgres provides a PostgreSQL implementation of the go-sync-kit EventStore with real-time LISTEN/NOTIFY capabilities for event streaming.
example command
Package sqlite provides a SQLite implementation of the go-sync-kit EventStore.
Package sqlite provides a SQLite implementation of the go-sync-kit EventStore.

Jump to

Keyboard shortcuts

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