dao

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Jun 22, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrRecordNotFound = gorm.ErrRecordNotFound
)

Functions

func InitTables

func InitTables(db *egorm.Component) error

Types

type GORMInteractiveDAO

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

func NewInteractiveDAO

func NewInteractiveDAO(db *egorm.Component) *GORMInteractiveDAO

func (*GORMInteractiveDAO) CollectToggle

func (g *GORMInteractiveDAO) CollectToggle(ctx context.Context, cb UserCollectionBiz) error

func (*GORMInteractiveDAO) Get

func (*GORMInteractiveDAO) GetByIds

func (g *GORMInteractiveDAO) GetByIds(ctx context.Context, biz string, ids []int64) ([]Interactive, error)

func (*GORMInteractiveDAO) GetCollectInfo

func (g *GORMInteractiveDAO) GetCollectInfo(ctx context.Context, biz string, id int64, uid int64) (UserCollectionBiz, error)

func (*GORMInteractiveDAO) GetLikeInfo

func (g *GORMInteractiveDAO) GetLikeInfo(ctx context.Context, biz string, id int64, uid int64) (UserLikeBiz, error)

func (*GORMInteractiveDAO) IncrViewCnt

func (g *GORMInteractiveDAO) IncrViewCnt(ctx context.Context, biz string, bizId int64) error

func (*GORMInteractiveDAO) LikeToggle

func (g *GORMInteractiveDAO) LikeToggle(ctx context.Context, biz string, id int64, uid int64) error

type Interactive

type Interactive struct {
	Id         int64  `gorm:"primaryKey,autoIncrement"`
	BizId      int64  `gorm:"uniqueIndex:biz_type_id"`
	Biz        string `gorm:"type:varchar(128);uniqueIndex:biz_type_id"`
	ViewCnt    int
	LikeCnt    int
	CollectCnt int
	Utime      int64
	Ctime      int64
}

汇总表

type InteractiveDAO

type InteractiveDAO interface {
	IncrViewCnt(ctx context.Context, biz string, bizId int64) error
	LikeToggle(ctx context.Context, biz string, id int64, uid int64) error
	CollectToggle(ctx context.Context, cb UserCollectionBiz) error
	GetLikeInfo(ctx context.Context,
		biz string, id int64, uid int64) (UserLikeBiz, error)
	GetCollectInfo(ctx context.Context,
		biz string, id int64, uid int64) (UserCollectionBiz, error)
	Get(ctx context.Context, biz string, id int64) (Interactive, error)
	GetByIds(ctx context.Context, biz string, ids []int64) ([]Interactive, error)
}

type UserCollectionBiz

type UserCollectionBiz struct {
	Id    int64  `gorm:"primaryKey,autoIncrement"`
	Uid   int64  `gorm:"uniqueIndex:uid_biz_type_id"`
	BizId int64  `gorm:"uniqueIndex:uid_biz_type_id"`
	Biz   string `gorm:"type:varchar(128);uniqueIndex:uid_biz_type_id"`
	Utime int64
	Ctime int64
}

收藏明细表

type UserLikeBiz

type UserLikeBiz struct {
	Id    int64  `gorm:"primaryKey,autoIncrement"`
	Uid   int64  `gorm:"uniqueIndex:uid_biz_type_id"`
	BizId int64  `gorm:"uniqueIndex:uid_biz_type_id"`
	Biz   string `gorm:"type:varchar(128);uniqueIndex:uid_biz_type_id"`
	Utime int64
	Ctime int64
}

点赞明细表

Jump to

Keyboard shortcuts

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