Documentation
¶
Index ¶
- type Entry
- type KV
- type TypedKV
- func (t *TypedKV[T]) Delete(ctx context.Context, key string) error
- func (t *TypedKV[T]) Get(ctx context.Context, key string) (T, error)
- func (t *TypedKV[T]) Has(ctx context.Context, key string) (bool, error)
- func (t *TypedKV[T]) Set(ctx context.Context, key string, value T) error
- func (t *TypedKV[T]) SetTTL(ctx context.Context, key string, value T, ttl time.Duration) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Entry ¶
type Entry struct {
Key string
Value json.RawMessage
ExpiresAt *time.Time
CreatedAt time.Time
UpdatedAt time.Time
}
Entry represents a raw KV entry with metadata.
type KV ¶
type KV interface {
Get(ctx context.Context, key string, dest any) error
Set(ctx context.Context, key string, value any) error
SetTTL(ctx context.Context, key string, value any, ttl time.Duration) error
Delete(ctx context.Context, key string) error
Has(ctx context.Context, key string) (bool, error)
ListKeys(ctx context.Context) ([]string, error)
GetRaw(ctx context.Context, key string) (Entry, error)
}
KV is the interface for a persistent key-value store. Keys are strings, values are JSON-serializable. Get on a missing key returns an error wrapping sql.ErrNoRows.
type TypedKV ¶
type TypedKV[T any] struct { // contains filtered or unexported fields }
TypedKV provides type-safe access to a KV store for a specific type T.
Click to show internal directories.
Click to hide internal directories.