Documentation
¶
Overview ¶
Package database provides a SQLite-backed key-value storage adapter.
pkg/adapter/storage/database/storage.go
Index ¶
- Variables
- type Config
- type Storage
- func (s *Storage) Close() error
- func (s *Storage) Delete(ctx context.Context, key string) error
- func (s *Storage) List(ctx context.Context, prefix string) ([]string, error)
- func (s *Storage) Load(ctx context.Context, key string) (any, error)
- func (s *Storage) Save(ctx context.Context, key string, data any) error
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrNotFound indicates key was not found ErrNotFound = errors.New("key not found") // ErrInvalidKey indicates empty or malformed key ErrInvalidKey = errors.New("invalid key") // ErrConnection indicates database connection failure ErrConnection = errors.New("database connection error") )
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
// DriverName is the database driver (e.g., "postgres", "mysql", "sqlite3")
DriverName string
// DSN is the data source name / connection string
DSN string
// TableName is the name of the storage table (default: "morpheus_storage")
TableName string
// MaxOpenConns is max open connections (default: 25)
MaxOpenConns int
// MaxIdleConns is max idle connections (default: 5)
MaxIdleConns int
}
Config holds database configuration
type Storage ¶
type Storage struct {
// contains filtered or unexported fields
}
Storage provides database-backed persistence
func NewStorage ¶
NewStorage creates a new database storage adapter
Click to show internal directories.
Click to hide internal directories.