dao

package
v0.0.0-...-de569a9 Latest Latest
Warning

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

Go to latest
Published: May 21, 2021 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InitMysql

func InitMysql(host, port, user, password, dbName string) (err error)

初始化数据库

Types

type UserDAO

type UserDAO interface {
	// 根据邮箱查询
	SelectByEmail(email string) (*UserEntity, error)
	// 保存
	Save(user *UserEntity) error
}

用户数据访问接口

type UserDAOImpl

type UserDAOImpl struct {
}

用户数据访问实现

func (*UserDAOImpl) Save

func (u *UserDAOImpl) Save(user *UserEntity) error

保存

func (*UserDAOImpl) SelectByEmail

func (u *UserDAOImpl) SelectByEmail(email string) (*UserEntity, error)

根据邮箱查询

type UserEntity

type UserEntity struct {
	ID int64
	// 用户名
	Username string
	// 密码
	Password string
	// 邮箱
	Email string
	// 创建日期
	CreatedAt time.Time
}

用户实体

func (UserEntity) TableName

func (UserEntity) TableName() string

表名

Jump to

Keyboard shortcuts

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