model

package
v0.0.0-...-2b318b0 Latest Latest
Warning

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

Go to latest
Published: May 16, 2023 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrUserNotExist  = errors.New("user not exist")
	ErrInvalidPasswd = errors.New("Passwd or username not right")
	ErrInvalidParams = errors.New("Invalid params")
	ErrUserExist     = errors.New("user exist")
)

自定义登录或注册是的错误

Functions

This section is empty.

Types

type UserDao

type UserDao struct {
	// contains filtered or unexported fields
}
var (
	MyUserDao *UserDao
)

完成一些初始化工作,比如 MyUserDao, 这个后面需要 操作Redis的时候,会使用到

func NewUserMgr

func NewUserMgr(pool *redis.Pool) (userDao *UserDao)

一个工厂模式,获取到一个UserDao 变量(实例)

func (*UserDao) Login

func (ud *UserDao) Login(id int, passwd string) (user *common.User, err error)

完成登录操作,到Redis验证 1.如果登录的用户信息有效,则返回一个User实例 2.如果登录的用户信息无效,则返回一个nil 和 对应的自定义错误信息

func (*UserDao) Register

func (ud *UserDao) Register(user *common.User) (err error)

在服务器端完成注册

Jump to

Keyboard shortcuts

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