Documentation ¶
Index ¶
- func GeneratePassword(password string) ([]byte, error)
- func ValidatePassword(password string, hashed string) (isOk bool, err error)
- type IUserService
- type UserService
- func (u UserService) AddUser(user *model.User) (int64, error)
- func (u UserService) CheckPwd(name string, passwd string) (isOk bool, err error)
- func (u UserService) DeleteUser(id int64) error
- func (u UserService) FindUserByName(name string) (*model.User, error)
- func (u UserService) UpdateUser(user *model.User, isChangePwd bool) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GeneratePassword ¶
GeneratePassword @Description: 加密用户密码 @param password string @return []byte @return 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) 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
Click to show internal directories.
Click to hide internal directories.