dao

package
v0.0.0-...-11f987e Latest Latest
Warning

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

Go to latest
Published: Aug 27, 2023 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrUserDuplicateEmail = errors.New("邮箱冲突")
)

Functions

func InitTables

func InitTables(db *gorm.DB) error

Types

type User

type User struct {
	// 自增 ID
	Id int64 `gorm:"primaryKey,autoIncrement"`
	// 邮箱必须唯一
	Email    string `gorm:"unique"`
	Password string
	// 创建时间
	Ctime int64
	// 更新时间
	Utime int64

	Birthday string
	Intro    string
	Nickname string
}

type UserDao

type UserDao struct {
	// contains filtered or unexported fields
}

func NewUserDao

func NewUserDao(db *gorm.DB) *UserDao

func (*UserDao) FindByEmail

func (dao *UserDao) FindByEmail(ctx *gin.Context, email string) (User, error)

func (*UserDao) FindById

func (dao *UserDao) FindById(ctx *gin.Context, id int64) (User, error)

func (*UserDao) FindProfileById

func (dao *UserDao) FindProfileById(ctx *gin.Context, id int64) (User, error)

func (*UserDao) Insert

func (dao *UserDao) Insert(ctx context.Context, u User) error

插入 user记录信息

func (*UserDao) InsertById

func (dao *UserDao) InsertById(ctx *gin.Context, id int64, user User) error

Jump to

Keyboard shortcuts

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