userservice

package
v0.7.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 3, 2021 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL