v12.1.6 Latest Latest

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

Go to latest
Published: Feb 5, 2020 License: BSD-3-Clause Imports: 3 Imported by: 9




This section is empty.


This section is empty.


This section is empty.


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.

Jump to

Keyboard shortcuts

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