user_subscribe.go
2.0 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
package domain
import (
"context"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/interanl/pkg/db/transaction"
"gorm.io/plugin/soft_delete"
)
type UserSubscribe struct {
Id int64 `json:"id"` // 唯一标识
Type int `json:"type"` // 分类(1评论回复 2获赞 3关注人更新)
CompanyId int64 `json:"companyId"` // 公司ID
UserId int64 `json:"userId"` // 用户ID
Count int `json:"count"` // 订阅次数
CreatedAt int64 `json:",omitempty"` // 创建时间
UpdatedAt int64 `json:",omitempty"` // 更新时间
DeletedAt int64 `json:",omitempty"` // 删除时间
Version int `json:",omitempty"` // 版本
IsDel soft_delete.DeletedAt `gorm:"softDelete:flag,DeletedAtField:DeletedAt"` // 删除标记
}
type UserSubscribeRepository interface {
Insert(ctx context.Context, conn transaction.Conn, dm *UserSubscribe) (*UserSubscribe, error)
Update(ctx context.Context, conn transaction.Conn, dm *UserSubscribe) (*UserSubscribe, error)
UpdateWithVersion(ctx context.Context, conn transaction.Conn, dm *UserSubscribe) (*UserSubscribe, error)
Delete(ctx context.Context, conn transaction.Conn, dm *UserSubscribe) (*UserSubscribe, error)
FindOne(ctx context.Context, conn transaction.Conn, id int64) (*UserSubscribe, error)
FindOneByType(ctx context.Context, conn transaction.Conn, companyId, userId int64, mType int) (*UserSubscribe, error)
Find(ctx context.Context, conn transaction.Conn, queryOptions map[string]interface{}) (int64, []*UserSubscribe, error)
}
func (m *UserSubscribe) Identify() interface{} {
if m.Id == 0 {
return nil
}
return m.Id
}