-
Notifications
You must be signed in to change notification settings - Fork 0
/
unionid.go
43 lines (36 loc) · 877 Bytes
/
unionid.go
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
38
39
40
41
42
43
package domain
import (
"context"
"time"
)
const (
_ = iota
UnionidDtWechat
)
type Unionid struct {
ID int `gorm:"column:id;primaryKey"`
UserId int `gorm:"column:user_id"`
Unionid string `gorm:"column:unionid"`
DataType int `gorm:"column:data_type"`
CreatedAt int64 `gorm:"column:created_at"`
UpdatedAt int64 `gorm:"column:updated_at"`
}
func NewUnionid(unionid string, dt int) *Unionid {
now := time.Now().Unix()
return &Unionid{
Unionid: unionid,
DataType: dt,
CreatedAt: now,
UpdatedAt: now,
}
}
func (*Unionid) TableName() string {
return "user_unionid"
}
func (u *Unionid) SetUserID(id int) {
u.UserId = id
}
type IUnionidRepository interface {
GetOneByUnionIdAndType(ctx context.Context, unionid string, dt int) (*Unionid, error)
DelByUnionIdAndTypeFromCache(ctx context.Context, unionid string, dt int) error
}