Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type UserService ¶
type UserService interface { GetAll() []datamodels.User GetByID(id int64) (datamodels.User, bool) GetByUsernameAndPassword(username, userPassword string) (datamodels.User, bool) DeleteByID(id int64) bool Update(id int64, user datamodels.User) (datamodels.User, error) UpdatePassword(id int64, newPassword string) (datamodels.User, error) UpdateUsername(id int64, newUsername string) (datamodels.User, error) Create(userPassword string, user datamodels.User) (datamodels.User, error) }
UserService handles CRUID operations of a user datamodel, it depends on a user repository for its actions. It's here to decouple the data source from the higher level compoments. As a result a different repository type can be used with the same logic without any aditional changes. It's an interface and it's used as interface everywhere because we may need to change or try an experimental different domain logic at the future.
func NewUserService ¶
func NewUserService(repo repositories.UserRepository) UserService
NewUserService returns the default user service.
Click to show internal directories.
Click to hide internal directories.