service

package
v0.0.0-...-877ca1b Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2022 License: MulanPSL-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GeneratePassword

func GeneratePassword(password string) ([]byte, error)

GeneratePassword @Description: 加密用户密码 @param password string @return []byte @return error

func ValidatePassword

func ValidatePassword(password string, hashed string) (isOk bool, err error)

Types

type IUserService

type IUserService interface {
	AddUser(user *model.User) (int64, error)
	DeleteUser(id int64) error
	UpdateUser(user *model.User, isChangePwd bool) error
	FindUserByName(name string) (*model.User, error)
	CheckPwd(name string, pwd string) (isOk bool, err error)
}

func NewUserService

func NewUserService(userRepository repository.IUserRepository) IUserService

type UserService

type UserService struct {
	// interface 本身可以传指针和非指针的值
	UserRepository repository.IUserRepository
}

func (UserService) AddUser

func (u UserService) AddUser(user *model.User) (int64, error)

func (UserService) CheckPwd

func (u UserService) CheckPwd(name string, passwd string) (isOk bool, err error)

func (UserService) DeleteUser

func (u UserService) DeleteUser(id int64) error

func (UserService) FindUserByName

func (u UserService) FindUserByName(name string) (*model.User, error)

func (UserService) UpdateUser

func (u UserService) UpdateUser(user *model.User, isChangePwd bool) error

Jump to

Keyboard shortcuts

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