Documentation ¶
Index ¶
- Constants
- func NewInMemoryStorage(t *testing.T, funcs ...func(s persistence.Storage)) (s persistence.Storage)
- func NewInMemoryStorageWithListError(t *testing.T, listErrorMsg string, funcs ...func(s persistence.Storage)) persistence.Storage
- func NewInMemoryStorageWithSaveError(t *testing.T, saveErrorMsg string, funcs ...func(s persistence.Storage)) persistence.Storage
- type StorageWithError
- func (s *StorageWithError) Count(_ interface{}, _ ...interface{}) (int64, error)
- func (s *StorageWithError) Create(_ interface{}) error
- func (s *StorageWithError) Delete(_ interface{}, _ ...interface{}) error
- func (s *StorageWithError) Get(_ interface{}, _ ...interface{}) error
- func (s *StorageWithError) List(_ interface{}, _ string, _ bool, _ int, _ int, _ ...interface{}) error
- func (s *StorageWithError) Save(_ interface{}, _ ...interface{}) error
- func (*StorageWithError) Update(_ interface{}, _ interface{}, _ ...interface{}) error
- type StorageWithListError
- type StorageWithSaveError
Constants ¶
const (
// DefaultServiceID is used for testing (unit and integration tests)
DefaultServiceID = "00000000-0000-0000-0000-000000000000"
)
Variables ¶
This section is empty.
Functions ¶
func NewInMemoryStorage ¶
func NewInMemoryStorage(t *testing.T, funcs ...func(s persistence.Storage)) (s persistence.Storage)
NewInMemoryStorage uses the Clouditor inmemory package to create a new in-memory storage that can be used for unit testing. The funcs varargs can be used to immediately execute storage operations on it.
func NewInMemoryStorageWithListError ¶ added in v0.2.0
func NewInMemoryStorageWithListError(t *testing.T, listErrorMsg string, funcs ...func(s persistence.Storage)) persistence.Storage
NewInMemoryStorageWithListError uses the Clouditor in-memory package to create a new in-memory storage that can be used for unit testing. The funcs varargs can be used to immediately execute storage operations on it.
func NewInMemoryStorageWithSaveError ¶ added in v0.2.0
func NewInMemoryStorageWithSaveError(t *testing.T, saveErrorMsg string, funcs ...func(s persistence.Storage)) persistence.Storage
NewInMemoryStorageWithSaveError uses the Clouditor in-memory package to create a new in-memory storage that can be used for unit testing. The funcs varargs can be used to immediately execute storage operations on it.
Types ¶
type StorageWithError ¶
type StorageWithError struct { CreateErr error SaveErr error UpdateErr error GetErr error ListErr error CountErr error DeleteErr error }
StorageWithError can be used to introduce various errors in a storage operation during unit testing.
func (*StorageWithError) Count ¶
func (s *StorageWithError) Count(_ interface{}, _ ...interface{}) (int64, error)
func (*StorageWithError) Create ¶
func (s *StorageWithError) Create(_ interface{}) error
func (*StorageWithError) Delete ¶
func (s *StorageWithError) Delete(_ interface{}, _ ...interface{}) error
func (*StorageWithError) Get ¶
func (s *StorageWithError) Get(_ interface{}, _ ...interface{}) error
func (*StorageWithError) Save ¶
func (s *StorageWithError) Save(_ interface{}, _ ...interface{}) error
func (*StorageWithError) Update ¶
func (*StorageWithError) Update(_ interface{}, _ interface{}, _ ...interface{}) error
type StorageWithListError ¶ added in v0.2.0
type StorageWithListError struct { persistence.Storage ListErr error }
StorageWithListError can be used to introduce various errors (without Create) in a storage operation during unit testing.
type StorageWithSaveError ¶ added in v0.2.0
type StorageWithSaveError struct { persistence.Storage SaveErr error }
StorageWithSaveError can be used to introduce `save` error in a storage operation during unit testing.
func (*StorageWithSaveError) Save ¶ added in v0.2.0
func (s *StorageWithSaveError) Save(_ interface{}, _ ...interface{}) error