Documentation
¶
Index ¶
- type KVEntry
- type KVService
- func (s *KVService) Delete(ctx context.Context, key string) error
- func (s *KVService) Get(ctx context.Context, key string) (string, bool, error)
- func (s *KVService) GetBool(ctx context.Context, key string, defaultValue bool) (bool, error)
- func (s *KVService) GetInt64(ctx context.Context, key string, defaultValue int64) (int64, error)
- func (s *KVService) GetTyped[T any](ctx context.Context, key string, defaultValue T, parse func(string) (T, error)) (T, error)
- func (s *KVService) IncrementInt64(ctx context.Context, key string, delta int64) (int64, error)
- func (s *KVService) ListByPrefix(ctx context.Context, prefix string) ([]KVEntry, error)
- func (s *KVService) Set(ctx context.Context, key, value string) error
- func (s *KVService) SetBool(ctx context.Context, key string, value bool) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type KVEntry ¶ added in v2.8.1
type KVEntry struct {
Key string `gorm:"column:key;primaryKey"`
Value string `gorm:"column:value"`
CreatedAt time.Time `gorm:"column:created_at;autoCreateTime"`
UpdatedAt *time.Time `gorm:"column:updated_at;autoUpdateTime"`
}
KVEntry stores lightweight application state as arbitrary key/value pairs.
type KVService ¶
type KVService struct {
// contains filtered or unexported fields
}
KVService persists lightweight application state in the kv table.
func NewKVService ¶
func (*KVService) GetTyped ¶ added in v2.10.0
func (s *KVService) GetTyped[T any](ctx context.Context, key string, defaultValue T, parse func(string) (T, error)) (T, error)
GetTyped loads one kv entry and parses it, returning defaultValue when the key is absent or unreadable.
func (*KVService) IncrementInt64 ¶
func (*KVService) ListByPrefix ¶
Click to show internal directories.
Click to hide internal directories.