Documentation ¶
Overview ¶
Package user is a generated GoMock package.
Index ¶
- type Change
- type Changes
- type Entity
- type MockStorage
- func (m *MockStorage) Delete(ctx context.Context, runner storage.Runner, id string) error
- func (m *MockStorage) EXPECT() *MockStorageMockRecorder
- func (m *MockStorage) Persist(ctx context.Context, run storage.Runner, user storage.User) (string, error)
- func (m *MockStorage) Retrieve(ctx context.Context, run storage.Runner, id string, forUpdate bool) (storage.User, error)
- func (m *MockStorage) Update(ctx context.Context, runner storage.Runner, id string, user storage.User) (storage.User, error)
- func (m *MockStorage) WithTx(arg0 context.Context, arg1 func(storage.Runner) error) error
- func (m *MockStorage) WithoutTx(arg0 context.Context, arg1 func(storage.Runner) error) error
- type MockStorageMockRecorder
- func (mr *MockStorageMockRecorder) Delete(ctx, runner, id interface{}) *gomock.Call
- func (mr *MockStorageMockRecorder) Persist(ctx, run, user interface{}) *gomock.Call
- func (mr *MockStorageMockRecorder) Retrieve(ctx, run, id, forUpdate interface{}) *gomock.Call
- func (mr *MockStorageMockRecorder) Update(ctx, runner, id, user interface{}) *gomock.Call
- func (mr *MockStorageMockRecorder) WithTx(arg0, arg1 interface{}) *gomock.Call
- func (mr *MockStorageMockRecorder) WithoutTx(arg0, arg1 interface{}) *gomock.Call
- type MockTransactioner
- type MockTransactionerMockRecorder
- type Service
- type Storage
- type Transactioner
- type ValidationError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type MockStorage ¶
type MockStorage struct {
// contains filtered or unexported fields
}
MockStorage is a mock of Storage interface
func NewMockStorage ¶
func NewMockStorage(ctrl *gomock.Controller) *MockStorage
NewMockStorage creates a new mock instance
func (*MockStorage) EXPECT ¶
func (m *MockStorage) EXPECT() *MockStorageMockRecorder
EXPECT returns an object that allows the caller to indicate expected use
func (*MockStorage) Persist ¶
func (m *MockStorage) Persist(ctx context.Context, run storage.Runner, user storage.User) (string, error)
Persist mocks base method
func (*MockStorage) Retrieve ¶
func (m *MockStorage) Retrieve(ctx context.Context, run storage.Runner, id string, forUpdate bool) (storage.User, error)
Retrieve mocks base method
func (*MockStorage) Update ¶
func (m *MockStorage) Update(ctx context.Context, runner storage.Runner, id string, user storage.User) (storage.User, error)
Update mocks base method
type MockStorageMockRecorder ¶
type MockStorageMockRecorder struct {
// contains filtered or unexported fields
}
MockStorageMockRecorder is the mock recorder for MockStorage
func (*MockStorageMockRecorder) Delete ¶
func (mr *MockStorageMockRecorder) Delete(ctx, runner, id interface{}) *gomock.Call
Delete indicates an expected call of Delete
func (*MockStorageMockRecorder) Persist ¶
func (mr *MockStorageMockRecorder) Persist(ctx, run, user interface{}) *gomock.Call
Persist indicates an expected call of Persist
func (*MockStorageMockRecorder) Retrieve ¶
func (mr *MockStorageMockRecorder) Retrieve(ctx, run, id, forUpdate interface{}) *gomock.Call
Retrieve indicates an expected call of Retrieve
func (*MockStorageMockRecorder) Update ¶
func (mr *MockStorageMockRecorder) Update(ctx, runner, id, user interface{}) *gomock.Call
Update indicates an expected call of Update
func (*MockStorageMockRecorder) WithTx ¶
func (mr *MockStorageMockRecorder) WithTx(arg0, arg1 interface{}) *gomock.Call
WithTx indicates an expected call of WithTx
func (*MockStorageMockRecorder) WithoutTx ¶
func (mr *MockStorageMockRecorder) WithoutTx(arg0, arg1 interface{}) *gomock.Call
WithoutTx indicates an expected call of WithoutTx
type MockTransactioner ¶
type MockTransactioner struct {
// contains filtered or unexported fields
}
MockTransactioner is a mock of Transactioner interface
func NewMockTransactioner ¶
func NewMockTransactioner(ctrl *gomock.Controller) *MockTransactioner
NewMockTransactioner creates a new mock instance
func (*MockTransactioner) EXPECT ¶
func (m *MockTransactioner) EXPECT() *MockTransactionerMockRecorder
EXPECT returns an object that allows the caller to indicate expected use
type MockTransactionerMockRecorder ¶
type MockTransactionerMockRecorder struct {
// contains filtered or unexported fields
}
MockTransactionerMockRecorder is the mock recorder for MockTransactioner
func (*MockTransactionerMockRecorder) WithTx ¶
func (mr *MockTransactionerMockRecorder) WithTx(arg0, arg1 interface{}) *gomock.Call
WithTx indicates an expected call of WithTx
func (*MockTransactionerMockRecorder) WithoutTx ¶
func (mr *MockTransactionerMockRecorder) WithoutTx(arg0, arg1 interface{}) *gomock.Call
WithoutTx indicates an expected call of WithoutTx
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service allows to CRUD user entity. On each user modification it sends a notification about changes made to user entity.
func NewService ¶
NewService returns initialized user service.
type Storage ¶
type Storage interface { Transactioner // Persist saves the user and returns it's unique generated ID. // It returns an error in case email or nickname is not unique. Persist(ctx context.Context, run storage.Runner, user storage.User) (string, error) // Retrieve returns user by supplied 'id'. // If user doesn't exist it returns an error. Retrieve(ctx context.Context, run storage.Runner, id string, forUpdate bool) (storage.User, error) // Update updates properties of the existing user and returns entity with old values. // If user doesn't exist it returns an error. Update(ctx context.Context, runner storage.Runner, id string, user storage.User) (storage.User, error) // Delete deletes user entity by its identifier. Delete(ctx context.Context, runner storage.Runner, id string) error }
Storage is a persistence storage for the user entity.
type Transactioner ¶
type Transactioner interface { // WithTx executes provided callback inside of the transaction. // If callback returns an error the transaction will be rolled back, otherwise it will be committed. WithTx(context.Context, func(runner storage.Runner) error) error // WithoutTx executes provided callback without explicitly open transaction. WithoutTx(context.Context, func(runner storage.Runner) error) error }
Transactioner executes statements with/without explicitly open transaction.
type ValidationError ¶
type ValidationError struct { // Cause should be one of pre-defined standard errors. Cause error // Details any additional details about validation failure. Details map[string]interface{} }
ValidationError encapsulates in it validation failure details.
func (ValidationError) Error ¶
func (ve ValidationError) Error() string
func (ValidationError) Is ¶
func (ve ValidationError) Is(err error) bool