Documentation
¶
Overview ¶
Package service holds service layer methods and repository/database abstractions.
Index ¶
- type Repository
- type Service
- func (s *Service) CreateUser(ctx context.Context, user model.User) (model.User, error)
- func (s *Service) DeleteUser(ctx context.Context, id string) error
- func (s *Service) FindAllUsers(ctx context.Context, offset int64, limit int64) ([]model.User, error)
- func (s *Service) FindUser(ctx context.Context, id string) (model.User, error)
- func (s *Service) UpdateUser(ctx context.Context, id string, userUpdate request.UserUpdate) (model.User, error)
- type Timer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Repository ¶ added in v0.3.0
type Repository interface {
FindUser(ctx context.Context, id string) (model.User, error)
CreateUser(ctx context.Context, user model.User) (string, error)
UpdateUser(ctx context.Context, user model.User) error
DeleteUser(ctx context.Context, id string) error
FindAllUsers(ctx context.Context, offset int64, limit int64) ([]model.User, error)
}
Repository abstracts the data access layer.
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service represents the user domain service layer.
func New ¶ added in v0.3.1
func New(repo Repository, timer Timer) *Service
New instantiates a Service
func (*Service) CreateUser ¶ added in v0.2.0
CreateUser - Creates a new user. Returns the created user or an error if anything fails.
func (*Service) DeleteUser ¶ added in v0.2.0
DeleteUser - Removes a user from the database. It returns an error if anything fails.
func (*Service) FindAllUsers ¶ added in v0.8.0
func (s *Service) FindAllUsers(ctx context.Context, offset int64, limit int64) ([]model.User, error)
FindAllUsers - Returns all users, for a given limit and offset
Click to show internal directories.
Click to hide internal directories.