Documentation
¶
Overview ¶
Package kv provides key-value storage with function isolation. Each function has its own isolated key-value store identified by functionID. Supports both in-memory and SQLite-backed implementations.
Index ¶
- type Error
- type MemoryStore
- func (m *MemoryStore) All(functionID string) (map[string]string, error)
- func (m *MemoryStore) AllGlobal() (map[string]string, error)
- func (m *MemoryStore) Delete(functionID, key string) error
- func (m *MemoryStore) DeleteGlobal(key string) error
- func (m *MemoryStore) Get(functionID, key string) (string, error)
- func (m *MemoryStore) GetGlobal(key string) (string, error)
- func (m *MemoryStore) ListGlobalKeys() ([]string, error)
- func (m *MemoryStore) ListKeys(functionID string) ([]string, error)
- func (m *MemoryStore) Set(functionID, key, value string) error
- func (m *MemoryStore) SetGlobal(key, value string) error
- type SQLiteStore
- func (s *SQLiteStore) All(functionID string) (map[string]string, error)
- func (s *SQLiteStore) AllGlobal() (map[string]string, error)
- func (s *SQLiteStore) Delete(functionID, key string) error
- func (s *SQLiteStore) DeleteGlobal(key string) error
- func (s *SQLiteStore) Get(functionID, key string) (string, error)
- func (s *SQLiteStore) GetGlobal(key string) (string, error)
- func (s *SQLiteStore) ListGlobalKeys() ([]string, error)
- func (s *SQLiteStore) ListKeys(functionID string) ([]string, error)
- func (s *SQLiteStore) Set(functionID, key, value string) error
- func (s *SQLiteStore) SetGlobal(key, value string) error
- type Store
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type MemoryStore ¶
type MemoryStore struct {
// contains filtered or unexported fields
}
MemoryStore is an in-memory implementation of Store
func NewMemoryStore ¶
func NewMemoryStore() *MemoryStore
NewMemoryStore creates a new in-memory KV store
func (*MemoryStore) All ¶
func (m *MemoryStore) All(functionID string) (map[string]string, error)
All returns all key-value pairs for a given functionID
func (*MemoryStore) AllGlobal ¶
func (m *MemoryStore) AllGlobal() (map[string]string, error)
AllGlobal returns all key-value pairs in the global store
func (*MemoryStore) Delete ¶
func (m *MemoryStore) Delete(functionID, key string) error
Delete removes a key-value pair for a functionID
func (*MemoryStore) DeleteGlobal ¶
func (m *MemoryStore) DeleteGlobal(key string) error
DeleteGlobal removes a key-value pair from the global key-value store
func (*MemoryStore) Get ¶
func (m *MemoryStore) Get(functionID, key string) (string, error)
Get retrieves a value by functionID and key
func (*MemoryStore) GetGlobal ¶
func (m *MemoryStore) GetGlobal(key string) (string, error)
GetGlobal retrieves a value from the global key-value store
func (*MemoryStore) ListGlobalKeys ¶
func (m *MemoryStore) ListGlobalKeys() ([]string, error)
ListGlobalKeys lists all keys in the global key-value store
func (*MemoryStore) ListKeys ¶
func (m *MemoryStore) ListKeys(functionID string) ([]string, error)
ListKeys lists all keys for a given functionID
func (*MemoryStore) Set ¶
func (m *MemoryStore) Set(functionID, key, value string) error
Set stores a key-value pair for a functionID
func (*MemoryStore) SetGlobal ¶
func (m *MemoryStore) SetGlobal(key, value string) error
SetGlobal sets a value in the global key-value store
type SQLiteStore ¶
type SQLiteStore struct {
// contains filtered or unexported fields
}
SQLiteStore is a SQLite-backed implementation of Store
func NewSQLiteStore ¶
func NewSQLiteStore(db *sql.DB) *SQLiteStore
NewSQLiteStore creates a new SQLite-backed KV store
func (*SQLiteStore) All ¶
func (s *SQLiteStore) All(functionID string) (map[string]string, error)
All returns all key-value pairs for a given functionID
func (*SQLiteStore) AllGlobal ¶
func (s *SQLiteStore) AllGlobal() (map[string]string, error)
AllGlobal returns all key-value pairs in the global store
func (*SQLiteStore) Delete ¶
func (s *SQLiteStore) Delete(functionID, key string) error
Delete removes a key-value pair for a functionID
func (*SQLiteStore) DeleteGlobal ¶
func (s *SQLiteStore) DeleteGlobal(key string) error
DeleteGlobal removes a key-value pair from the global key-value store
func (*SQLiteStore) Get ¶
func (s *SQLiteStore) Get(functionID, key string) (string, error)
Get retrieves a value by functionID and key
func (*SQLiteStore) GetGlobal ¶
func (s *SQLiteStore) GetGlobal(key string) (string, error)
GetGlobal retrieves a value from the global key-value store
func (*SQLiteStore) ListGlobalKeys ¶
func (s *SQLiteStore) ListGlobalKeys() ([]string, error)
ListGlobalKeys lists all keys in the global key-value store
func (*SQLiteStore) ListKeys ¶
func (s *SQLiteStore) ListKeys(functionID string) ([]string, error)
ListKeys lists all keys for a given functionID
func (*SQLiteStore) Set ¶
func (s *SQLiteStore) Set(functionID, key, value string) error
Set stores a key-value pair for a functionID
func (*SQLiteStore) SetGlobal ¶
func (s *SQLiteStore) SetGlobal(key, value string) error
SetGlobal sets a value in the global key-value store
type Store ¶
type Store interface {
Get(functionID, key string) (string, error)
Set(functionID, key, value string) error
Delete(functionID, key string) error
ListKeys(functionID string) ([]string, error)
GetGlobal(key string) (string, error)
SetGlobal(key, value string) error
DeleteGlobal(key string) error
ListGlobalKeys() ([]string, error)
All(functionID string) (map[string]string, error)
AllGlobal() (map[string]string, error)
}
Store is an interface for key-value storage operations functionID is used to isolate data between functions