Documentation ¶
Index ¶
- Variables
- func InitTables(db *egorm.Component) error
- type Collection
- type GORMInteractiveDAO
- func (g *GORMInteractiveDAO) CollectToggle(ctx context.Context, cb UserCollectionBiz) error
- func (g *GORMInteractiveDAO) CollectionInfo(ctx context.Context, collectionId int64) ([]UserCollectionBiz, error)
- func (g *GORMInteractiveDAO) CollectionInfoWithPage(ctx context.Context, uid, collectionId int64, offset, limit int) ([]UserCollectionBiz, error)
- func (g *GORMInteractiveDAO) CollectionList(ctx context.Context, uid int64, offset, limit int) ([]Collection, error)
- func (g *GORMInteractiveDAO) DecrCollectCount(ctx context.Context, biz string, bizid int64) error
- func (g *GORMInteractiveDAO) DeleteCollection(ctx context.Context, uid, collectionId int64) error
- func (g *GORMInteractiveDAO) Get(ctx context.Context, biz string, id int64) (Interactive, error)
- func (g *GORMInteractiveDAO) GetByIds(ctx context.Context, biz string, ids []int64) ([]Interactive, error)
- func (g *GORMInteractiveDAO) GetCollectInfo(ctx context.Context, biz string, id int64, uid int64) (UserCollectionBiz, error)
- func (g *GORMInteractiveDAO) GetLikeInfo(ctx context.Context, biz string, id int64, uid int64) (UserLikeBiz, error)
- func (g *GORMInteractiveDAO) IncrViewCnt(ctx context.Context, biz string, bizId int64) error
- func (g *GORMInteractiveDAO) LikeToggle(ctx context.Context, biz string, id int64, uid int64) error
- func (g *GORMInteractiveDAO) MoveCollection(ctx context.Context, biz string, bizid, uid, collectionId int64) error
- func (g *GORMInteractiveDAO) SaveCollection(ctx context.Context, collection Collection) (int64, error)
- type Interactive
- type InteractiveDAO
- type UserCollectionBiz
- type UserLikeBiz
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrDeleteOtherCollection = errors.New("删除非本人的收藏夹")
View Source
var (
ErrRecordNotFound = gorm.ErrRecordNotFound
)
Functions ¶
func InitTables ¶
Types ¶
type Collection ¶ added in v0.1.8
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) CollectionInfo ¶ added in v0.2.1
func (g *GORMInteractiveDAO) CollectionInfo(ctx context.Context, collectionId int64) ([]UserCollectionBiz, error)
func (*GORMInteractiveDAO) CollectionInfoWithPage ¶ added in v0.2.1
func (g *GORMInteractiveDAO) CollectionInfoWithPage(ctx context.Context, uid, collectionId int64, offset, limit int) ([]UserCollectionBiz, error)
func (*GORMInteractiveDAO) CollectionList ¶ added in v0.2.1
func (g *GORMInteractiveDAO) CollectionList(ctx context.Context, uid int64, offset, limit int) ([]Collection, error)
func (*GORMInteractiveDAO) DecrCollectCount ¶ added in v0.2.1
func (*GORMInteractiveDAO) DeleteCollection ¶ added in v0.2.1
func (g *GORMInteractiveDAO) DeleteCollection(ctx context.Context, uid, collectionId int64) error
func (*GORMInteractiveDAO) Get ¶
func (g *GORMInteractiveDAO) Get(ctx context.Context, biz string, id int64) (Interactive, error)
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 (*GORMInteractiveDAO) LikeToggle ¶
func (*GORMInteractiveDAO) MoveCollection ¶ added in v0.2.1
func (*GORMInteractiveDAO) SaveCollection ¶ added in v0.2.1
func (g *GORMInteractiveDAO) SaveCollection(ctx context.Context, collection Collection) (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 }
Interactive 汇总表
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) // 创建收藏夹 SaveCollection(ctx context.Context, collection Collection) (int64, error) // 删除收藏夹 DeleteCollection(ctx context.Context, uid, collectionId int64) error // 收藏夹列表 CollectionList(ctx context.Context, uid int64, offset, limit int) ([]Collection, error) // 收藏夹下的收藏内容带分页 CollectionInfoWithPage(ctx context.Context, uid, collectionId int64, offset, limit int) ([]UserCollectionBiz, error) // 收藏夹下的所有内容 CollectionInfo(ctx context.Context, collectionId int64) ([]UserCollectionBiz, error) // 收藏转移 MoveCollection(ctx context.Context, biz string, bizid, uid, collectionId int64) error // 减少计数 DecrCollectCount(ctx context.Context, biz string, bizid int64) 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"` // Cid 收藏夹id Cid int64 `gorm:"index;not null;default(0)"` Utime int64 Ctime int64 }
UserCollectionBiz 收藏明细表
Click to show internal directories.
Click to hide internal directories.