Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrNotFound = errors.New("not found")
ErrNotFound represent a not found error.
Functions ¶
func NewMongoDB ¶
func NewMongoDB() (*mongoDB, error)
NewMongoDB creates a new article repository backed by a given Mongo server, authenticated with given credentials.
Types ¶
type MockRepository ¶
type MockRepository struct {
// contains filtered or unexported fields
}
MockRepository is a mock of Repository interface It's generated by go mock by invoking this command: mockgen -source=srv.go See more at: https://github.com/golang/mock
func NewMockRepository ¶
func NewMockRepository(ctrl *gomock.Controller) *MockRepository
NewMockRepository creates a new mock instance
func (*MockRepository) AddUser ¶
func (_m *MockRepository) AddUser(u User) error
AddUser mocks base method
func (*MockRepository) EXPECT ¶
func (_m *MockRepository) EXPECT() *MockRepositoryMockRecorder
EXPECT returns an object that allows the caller to indicate expected use
func (*MockRepository) GetUsers ¶
func (_m *MockRepository) GetUsers() ([]*User, error)
GetUsers mocks base method
type MockRepositoryMockRecorder ¶
type MockRepositoryMockRecorder struct {
// contains filtered or unexported fields
}
MockRepositoryMockRecorder is the mock recorder for MockRepository
func (*MockRepositoryMockRecorder) AddUser ¶
func (_mr *MockRepositoryMockRecorder) AddUser(arg0 interface{}) *gomock.Call
AddUser indicates an expected call of AddUser
func (*MockRepositoryMockRecorder) GetUsers ¶
func (_mr *MockRepositoryMockRecorder) GetUsers() *gomock.Call
GetUsers indicates an expected call of GetUsers
type Repository ¶
Repository user data store.
type UserService ¶
type UserService struct {
// contains filtered or unexported fields
}
UserService hold all operations related to user.
func (*UserService) GetUsers ¶
func (s *UserService) GetUsers() ([]*User, error)
GetUsers return list of users. return error if no user found.
func (*UserService) SetRepo ¶
func (s *UserService) SetRepo(r Repository)
SetRepo set the repository to UserService for querying db