repository

package
v0.0.0-...-bef02c6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 8, 2024 License: MIT Imports: 9 Imported by: 0

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

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

func (m *MockRepositoryInterface) CreateUser(ctx context.Context, user model.User) error

CreateUser mocks base method.

func (*MockRepositoryInterface) EXPECT

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockRepositoryInterface) GetUserByID

func (m *MockRepositoryInterface) GetUserByID(ctx context.Context, id string) (*model.User, error)

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

func (m *MockRepositoryInterface) UpdateUser(ctx context.Context, user model.User) error

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

type Repository struct {
	Db *sql.DB
}

func NewRepository

func NewRepository(opts NewRepositoryOptions) *Repository

func (*Repository) CreateLoginLog

func (r *Repository) CreateLoginLog(ctx context.Context, loginLog model.LoginLog) error

func (*Repository) CreateUser

func (r *Repository) CreateUser(ctx context.Context, user model.User) error

func (*Repository) GetUserByID

func (r *Repository) GetUserByID(ctx context.Context, id string) (*model.User, error)

func (*Repository) GetUserByPhoneNumber

func (r *Repository) GetUserByPhoneNumber(ctx context.Context, phoneNumber string) (*model.User, error)

func (*Repository) UpdateUser

func (r *Repository) UpdateUser(ctx context.Context, user model.User) error

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
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL