Documentation ¶
Overview ¶
Users package is a sample business domain object package for application users
Index ¶
- func MakeHandler(us Service, logger kitlog.Logger) http.Handler
- type MockRepository
- type MockService
- func (_m *MockService) CreateUser(id int, fname string, lname string, color string) (int, error)
- func (_m *MockService) EXPECT() *_MockServiceRecorder
- func (_m *MockService) ReadUser(id int) (User, error)
- func (_m *MockService) UpdateUserColor(id int, color string) error
- func (_m *MockService) Users() []*User
- type Repository
- type Service
- type User
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type MockRepository ¶
type MockRepository struct {
// contains filtered or unexported fields
}
Mock of Repository interface
func NewMockRepository ¶
func NewMockRepository(ctrl *gomock.Controller) *MockRepository
func (*MockRepository) EXPECT ¶
func (_m *MockRepository) EXPECT() *_MockRepositoryRecorder
func (*MockRepository) FindAll ¶
func (_m *MockRepository) FindAll() []*User
func (*MockRepository) Store ¶
func (_m *MockRepository) Store(user *User) error
type MockService ¶
type MockService struct {
// contains filtered or unexported fields
}
Mock of Service interface
func NewMockService ¶
func NewMockService(ctrl *gomock.Controller) *MockService
func (*MockService) CreateUser ¶
func (*MockService) EXPECT ¶
func (_m *MockService) EXPECT() *_MockServiceRecorder
func (*MockService) UpdateUserColor ¶
func (_m *MockService) UpdateUserColor(id int, color string) error
func (*MockService) Users ¶
func (_m *MockService) Users() []*User
type Repository ¶
type Repository interface { // Store a new user in the repository Store(user *User) error // Find a user in the repository by ID Find(id int) (*User, error) // FindAll users in the repository FindAll() []*User }
(User) Repository is the set of behavior a repository, or "store", of users must conform to.
type Service ¶
type Service interface { // CreateUser defines a new user and returns its id CreateUser(id int, fname string, lname string, color string) (int, error) // ReadUser finds a user model by id ReadUser(id int) (User, error) // UpdateUserColor sets a user's favorite color UpdateUserColor(id int, color string) error // Users returns all users Users() []*User }
Service describes the behavior of a user service e.g. CRUD actions
func NewInstrumentingService ¶
NewInstrumentingService generates a new instance of our instrumented files service
func NewLoggingService ¶
NewLoggingService generates a new logging service
Click to show internal directories.
Click to hide internal directories.