dao

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

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

Go to latest
Published: Sep 10, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

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

Functions

This section is empty.

Types

type Interactive

type Interactive struct {
	Id            int64  `gorm:"primaryKey,autoIncrement"`
	BizId         int64  `gorm:"uniqueIndex=bizId_type"`
	Biz           string `gorm:"uniqueIndex=bizId_type"`
	ReadCount     int64
	LikeCount     int64
	FavoriteCount int64
	CreateTime    int64
	UpdateTime    int64
}

func (*Interactive) TableName

func (i *Interactive) TableName() string

type InteractiveDao

type InteractiveDao interface {
	IncreaseReadCount(ctx context.Context, biz string, bizId int64) error
	IncreaseLikeCount(ctx context.Context, biz string, bizId int64, uid int64) error
	DeletedLike(ctx context.Context, biz string, bizId int64, uid int64) error
}

type InteractiveDaoMysql

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

func NewInteractiveDaoMysql

func NewInteractiveDaoMysql(db *gorm.DB, logger *zap.Logger) *InteractiveDaoMysql

func (*InteractiveDaoMysql) DeletedLike

func (dao *InteractiveDaoMysql) DeletedLike(ctx context.Context, biz string, bizId int64, uid int64) error

func (*InteractiveDaoMysql) IncreaseLikeCount

func (dao *InteractiveDaoMysql) IncreaseLikeCount(ctx context.Context, biz string, bizId int64, uid int64) error

func (*InteractiveDaoMysql) IncreaseReadCount

func (dao *InteractiveDaoMysql) IncreaseReadCount(ctx context.Context, biz string, bizId int64) error

type User

type User struct {
	Id         int64          `gorm:"primaryKey,autoIncrement"` // 用户ID
	Email      sql.NullString `gorm:"unique"`                   // 用户邮箱
	Password   string         // 用户密码
	Phone      sql.NullString `gorm:"unique"`
	CreateTime int64          // 创建时间 毫秒数
	UpdateTime int64          // 更新时间 毫秒数
}

User 用户数据库对象

type UserDao

type UserDao interface {
	FindByEmail(ctx context.Context, email string) (User, error)
	// Insert 插入用户
	Insert(ctx context.Context, u User) error
	FindById(ctx context.Context, id int64) (User, error)
	FindByPhone(ctx context.Context, phone string) (User, error)
}

func NewUserDao

func NewUserDao(db *gorm.DB, l *zap.Logger) UserDao

type UserDaoImpl

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

func (*UserDaoImpl) FindByEmail

func (d *UserDaoImpl) FindByEmail(ctx context.Context, email string) (User, error)

func (*UserDaoImpl) FindById

func (d *UserDaoImpl) FindById(ctx context.Context, id int64) (User, error)

func (*UserDaoImpl) FindByPhone

func (d *UserDaoImpl) FindByPhone(ctx context.Context, phone string) (User, error)

func (*UserDaoImpl) Insert

func (d *UserDaoImpl) Insert(ctx context.Context, u User) error

Insert 插入用户

type UserLikeBiz

type UserLikeBiz struct {
	Id         int64  `gorm:"primaryKey,autoIncrement"`
	Uid        int64  `gorm:"uniqueIndex=uid_biz_bizId"`
	Biz        string `gorm:"uniqueIndex=uid_biz_bizId"`
	BizId      int64  `gorm:"uniqueIndex=uid_biz_bizId"`
	Status     int
	CreateTime int64
	UpdateTime int64
}

func (*UserLikeBiz) TableName

func (b *UserLikeBiz) TableName() string

Directories

Path Synopsis
Package mock is a generated GoMock package.
Package mock is a generated GoMock package.

Jump to

Keyboard shortcuts

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