Documentation ¶
Overview ¶
This file contains the interfaces for the repository layer. The repository layer is responsible for interacting with the database. For testing purpose we will generate mock implementations of these interfaces using mockgen. See the Makefile for more information.
Package repository is a generated GoMock package.
This file contains the repository implementation layer.
Index ¶
- type MockRepositoryInterface
- func (m *MockRepositoryInterface) CreateLoginLog(ctx context.Context, loginLog model.LoginLog) error
- func (m *MockRepositoryInterface) CreateUser(ctx context.Context, user model.User) error
- func (m *MockRepositoryInterface) EXPECT() *MockRepositoryInterfaceMockRecorder
- func (m *MockRepositoryInterface) GetUserByID(ctx context.Context, id string) (*model.User, error)
- func (m *MockRepositoryInterface) GetUserByPhoneNumber(ctx context.Context, phoneNumber string) (*model.User, error)
- func (m *MockRepositoryInterface) UpdateUser(ctx context.Context, user model.User) error
- type MockRepositoryInterfaceMockRecorder
- func (mr *MockRepositoryInterfaceMockRecorder) CreateLoginLog(ctx, loginLog interface{}) *gomock.Call
- func (mr *MockRepositoryInterfaceMockRecorder) CreateUser(ctx, user interface{}) *gomock.Call
- func (mr *MockRepositoryInterfaceMockRecorder) GetUserByID(ctx, id interface{}) *gomock.Call
- func (mr *MockRepositoryInterfaceMockRecorder) GetUserByPhoneNumber(ctx, phoneNumber interface{}) *gomock.Call
- func (mr *MockRepositoryInterfaceMockRecorder) UpdateUser(ctx, user interface{}) *gomock.Call
- type NewRepositoryOptions
- type Repository
- func (r *Repository) CreateLoginLog(ctx context.Context, loginLog model.LoginLog) error
- func (r *Repository) CreateUser(ctx context.Context, user model.User) error
- func (r *Repository) GetUserByID(ctx context.Context, id string) (*model.User, error)
- func (r *Repository) GetUserByPhoneNumber(ctx context.Context, phoneNumber string) (*model.User, error)
- func (r *Repository) UpdateUser(ctx context.Context, user model.User) error
- type RepositoryInterface
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type MockRepositoryInterface ¶
type MockRepositoryInterface struct {
// contains filtered or unexported fields
}
MockRepositoryInterface is a mock of RepositoryInterface interface.
func NewMockRepositoryInterface ¶
func NewMockRepositoryInterface(ctrl *gomock.Controller) *MockRepositoryInterface
NewMockRepositoryInterface creates a new mock instance.
func (*MockRepositoryInterface) CreateLoginLog ¶
func (m *MockRepositoryInterface) CreateLoginLog(ctx context.Context, loginLog model.LoginLog) error
CreateLoginLog mocks base method.
func (*MockRepositoryInterface) CreateUser ¶
CreateUser mocks base method.
func (*MockRepositoryInterface) EXPECT ¶
func (m *MockRepositoryInterface) EXPECT() *MockRepositoryInterfaceMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockRepositoryInterface) GetUserByID ¶
GetUserByID mocks base method.
func (*MockRepositoryInterface) GetUserByPhoneNumber ¶
func (m *MockRepositoryInterface) GetUserByPhoneNumber(ctx context.Context, phoneNumber string) (*model.User, error)
GetUserByPhoneNumber mocks base method.
func (*MockRepositoryInterface) UpdateUser ¶
UpdateUser mocks base method.
type MockRepositoryInterfaceMockRecorder ¶
type MockRepositoryInterfaceMockRecorder struct {
// contains filtered or unexported fields
}
MockRepositoryInterfaceMockRecorder is the mock recorder for MockRepositoryInterface.
func (*MockRepositoryInterfaceMockRecorder) CreateLoginLog ¶
func (mr *MockRepositoryInterfaceMockRecorder) CreateLoginLog(ctx, loginLog interface{}) *gomock.Call
CreateLoginLog indicates an expected call of CreateLoginLog.
func (*MockRepositoryInterfaceMockRecorder) CreateUser ¶
func (mr *MockRepositoryInterfaceMockRecorder) CreateUser(ctx, user interface{}) *gomock.Call
CreateUser indicates an expected call of CreateUser.
func (*MockRepositoryInterfaceMockRecorder) GetUserByID ¶
func (mr *MockRepositoryInterfaceMockRecorder) GetUserByID(ctx, id interface{}) *gomock.Call
GetUserByID indicates an expected call of GetUserByID.
func (*MockRepositoryInterfaceMockRecorder) GetUserByPhoneNumber ¶
func (mr *MockRepositoryInterfaceMockRecorder) GetUserByPhoneNumber(ctx, phoneNumber interface{}) *gomock.Call
GetUserByPhoneNumber indicates an expected call of GetUserByPhoneNumber.
func (*MockRepositoryInterfaceMockRecorder) UpdateUser ¶
func (mr *MockRepositoryInterfaceMockRecorder) UpdateUser(ctx, user interface{}) *gomock.Call
UpdateUser indicates an expected call of UpdateUser.
type NewRepositoryOptions ¶
type NewRepositoryOptions struct {
Dsn string
}
type Repository ¶
func NewRepository ¶
func NewRepository(opts NewRepositoryOptions) *Repository
func (*Repository) CreateLoginLog ¶
func (*Repository) CreateUser ¶
func (*Repository) GetUserByID ¶
func (*Repository) GetUserByPhoneNumber ¶
func (*Repository) UpdateUser ¶
type RepositoryInterface ¶
type RepositoryInterface interface { CreateUser(ctx context.Context, user model.User) error GetUserByPhoneNumber(ctx context.Context, phoneNumber string) (*model.User, error) GetUserByID(ctx context.Context, id string) (*model.User, error) UpdateUser(ctx context.Context, user model.User) error CreateLoginLog(ctx context.Context, loginLog model.LoginLog) error }