Documentation ¶
Index ¶
- Variables
- type UserService
- func (u *UserService) Delete(ID uint) error
- func (u *UserService) GetAll() ([]*domain.User, error)
- func (u *UserService) GetByID(ID uint) (*domain.User, error)
- func (u *UserService) GetByUsername(username string) (*domain.User, error)
- func (u *UserService) Register(user *domain.User) (uint, error)
- func (u *UserService) Update(user *domain.User) error
- func (u *UserService) Validate(credentials *domain.Credentials) (*domain.User, error)
Constants ¶
This section is empty.
Variables ¶
var ( // ProviderProductionSet provides a new UserService for use in production. ProviderProductionSet = wire.NewSet(Provide, wire.Bind(new(domain.UserService), new(*UserService))) )
Functions ¶
This section is empty.
Types ¶
type UserService ¶
type UserService struct {
// contains filtered or unexported fields
}
UserService is a service which processes information about a User.
func Provide ¶
func Provide(repository domain.UserRepository) *UserService
Provide provides a new UserService configured with the given UserRepository.
func (*UserService) Delete ¶
func (u *UserService) Delete(ID uint) error
Delete deletes the given User in the repository.
func (*UserService) GetAll ¶
func (u *UserService) GetAll() ([]*domain.User, error)
GetAll retrieves all Users in the repository.
func (*UserService) GetByID ¶
func (u *UserService) GetByID(ID uint) (*domain.User, error)
GetByID retrieves the User with the given ID from the repository.
func (*UserService) GetByUsername ¶
func (u *UserService) GetByUsername(username string) (*domain.User, error)
func (*UserService) Register ¶
func (u *UserService) Register(user *domain.User) (uint, error)
Register creates a new User in the repository.
func (*UserService) Update ¶
func (u *UserService) Update(user *domain.User) error
Update updates the given User in the repository.
func (*UserService) Validate ¶
func (u *UserService) Validate(credentials *domain.Credentials) (*domain.User, error)
Validate validates the given credentials by comparing the given plaintext password with the hashed password in the repository for the given username. If the credentials are valid, the User is returned. Otherwise, an error is returned with a nil User.