Documentation
¶
Index ¶
- type Config
- type CustomFuncs
- type Entry
- type Storage
- func (s *Storage) Close() error
- func (s *Storage) Conn() map[string]Entry
- func (s *Storage) Delete(key string) error
- func (s *Storage) DeleteWithContext(ctx context.Context, key string) error
- func (s *Storage) Get(key string) ([]byte, error)
- func (s *Storage) GetWithContext(ctx context.Context, key string) ([]byte, error)
- func (s *Storage) Keys() ([][]byte, error)
- func (s *Storage) Reset() error
- func (s *Storage) ResetWithContext(ctx context.Context) error
- func (s *Storage) Set(key string, val []byte, exp time.Duration) error
- func (s *Storage) SetCustomFuncs(custom *CustomFuncs)
- func (s *Storage) SetWithContext(ctx context.Context, key string, val []byte, exp time.Duration) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
CustomFuncs *CustomFuncs
}
Config defines the config for mock storage.
type CustomFuncs ¶
type CustomFuncs struct { GetFunc func(key string) ([]byte, error) GetWithContext func(ctx context.Context, key string) ([]byte, error) SetFunc func(key string, val []byte, exp time.Duration) error SetWithContext func(ctx context.Context, key string, val []byte, exp time.Duration) error DeleteFunc func(key string) error DeleteWithContext func(ctx context.Context, key string) error ResetFunc func() error ResetWithContext func(ctx context.Context) error CloseFunc func() error ConnFunc func() map[string]Entry KeysFunc func() ([][]byte, error) }
CustomFuncs allows injecting custom behaviors for testing.
type Storage ¶
type Storage struct {
// contains filtered or unexported fields
}
Storage is the mock storage adapter.
func (*Storage) DeleteWithContext ¶ added in v1.1.0
DeleteWithContext deletes key using context.
func (*Storage) GetWithContext ¶ added in v1.1.0
GetWithContext retrieves value by key using a context (functional or fallback)
func (*Storage) ResetWithContext ¶ added in v1.1.0
ResetWithContext resets storage using context.
func (*Storage) SetCustomFuncs ¶
func (s *Storage) SetCustomFuncs(custom *CustomFuncs)
SetCustomFuncs allows runtime injection of function implementations.
Click to show internal directories.
Click to hide internal directories.