services

package
v8.5.7+incompatible Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2017 License: BSD-3-Clause Imports: 3 Imported by: 0

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.

Jump to

Keyboard shortcuts

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