Documentation ¶
Overview ¶
Package shorten is a generated GoMock package.
Index ¶
- type Entity
- type MockStorage
- func (m *MockStorage) ByHash(ctx context.Context, runner storage.Runner, hash string) (shorten.Entity, error)
- func (m *MockStorage) Delete(ctx context.Context, runner storage.Runner, id int64) error
- func (m *MockStorage) EXPECT() *MockStorageMockRecorder
- func (m *MockStorage) List(ctx context.Context, run storage.Runner, pager shorten.Pager) ([]shorten.Entity, error)
- func (m *MockStorage) Persist(ctx context.Context, run storage.Runner, shorten shorten.Entity) (int64, error)
- func (m *MockStorage) Retrieve(ctx context.Context, run storage.Runner, id int64) (shorten.Entity, error)
- type MockStorageMockRecorder
- func (mr *MockStorageMockRecorder) ByHash(ctx, runner, hash interface{}) *gomock.Call
- func (mr *MockStorageMockRecorder) Delete(ctx, runner, id interface{}) *gomock.Call
- func (mr *MockStorageMockRecorder) List(ctx, run, pager interface{}) *gomock.Call
- func (mr *MockStorageMockRecorder) Persist(ctx, run, shorten interface{}) *gomock.Call
- func (mr *MockStorageMockRecorder) Retrieve(ctx, run, id interface{}) *gomock.Call
- type MockTransactioner
- type MockTransactionerMockRecorder
- type Pager
- type Service
- func (s *Service) Create(ctx context.Context, short Entity) (int64, error)
- func (s *Service) Delete(ctx context.Context, id int64) error
- func (s *Service) Get(ctx context.Context, id int64) (Entity, error)
- func (s *Service) List(ctx context.Context, pager Pager) ([]Entity, error)
- func (s *Service) Resolve(ctx context.Context, hash string) (string, error)
- 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) ByHash ¶
func (m *MockStorage) ByHash(ctx context.Context, runner storage.Runner, hash string) (shorten.Entity, error)
ByHash mocks base method
func (*MockStorage) EXPECT ¶
func (m *MockStorage) EXPECT() *MockStorageMockRecorder
EXPECT returns an object that allows the caller to indicate expected use
func (*MockStorage) List ¶
func (m *MockStorage) List(ctx context.Context, run storage.Runner, pager shorten.Pager) ([]shorten.Entity, error)
List mocks base method
type MockStorageMockRecorder ¶
type MockStorageMockRecorder struct {
// contains filtered or unexported fields
}
MockStorageMockRecorder is the mock recorder for MockStorage
func (*MockStorageMockRecorder) ByHash ¶
func (mr *MockStorageMockRecorder) ByHash(ctx, runner, hash interface{}) *gomock.Call
ByHash indicates an expected call of ByHash
func (*MockStorageMockRecorder) Delete ¶
func (mr *MockStorageMockRecorder) Delete(ctx, runner, id interface{}) *gomock.Call
Delete indicates an expected call of Delete
func (*MockStorageMockRecorder) List ¶
func (mr *MockStorageMockRecorder) List(ctx, run, pager interface{}) *gomock.Call
List indicates an expected call of List
func (*MockStorageMockRecorder) Persist ¶
func (mr *MockStorageMockRecorder) Persist(ctx, run, shorten interface{}) *gomock.Call
Persist indicates an expected call of Persist
func (*MockStorageMockRecorder) Retrieve ¶
func (mr *MockStorageMockRecorder) Retrieve(ctx, run, id interface{}) *gomock.Call
Retrieve indicates an expected call of Retrieve
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 CR_D shorten entity.
func NewService ¶
func NewService(tr Transactioner, storage Storage) *Service
NewService returns initialized shorten service.
type Storage ¶
type Storage interface { // Persist saves the shorten and returns it's unique generated ID. Persist(ctx context.Context, run storage.Runner, shorten shorten.Entity) (int64, error) // Retrieve returns shorten by supplied 'id'. // If shorten doesn't exist it returns an error. Retrieve(ctx context.Context, run storage.Runner, id int64) (shorten.Entity, error) List(ctx context.Context, run storage.Runner, pager shorten.Pager) ([]shorten.Entity, error) // Delete deletes shorten entity by its identifier. Delete(ctx context.Context, runner storage.Runner, id int64) error // ByHash returns shorten by supplied 'hash'. ByHash(ctx context.Context, runner storage.Runner, hash string) (shorten.Entity, error) }
Storage is a persistence storage for the shorten 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