user_wechat.go
1.7 KB
package domain
import (
"context"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/interanl/pkg/db/transaction"
"gorm.io/plugin/soft_delete"
)
type UserWechat struct {
Id int64 `json:"id"` // 唯一标识
OpenId string `json:"openId"` // 微信openId
Phone string `json:"phone"` // 微信手机号
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 UserWechatRepository interface {
Insert(ctx context.Context, conn transaction.Conn, dm *UserWechat) (*UserWechat, error)
Update(ctx context.Context, conn transaction.Conn, dm *UserWechat) (*UserWechat, error)
UpdateWithVersion(ctx context.Context, conn transaction.Conn, dm *UserWechat) (*UserWechat, error)
Delete(ctx context.Context, conn transaction.Conn, dm *UserWechat) (*UserWechat, error)
FindOne(ctx context.Context, conn transaction.Conn, id int64) (*UserWechat, error)
FindOneByPhone(ctx context.Context, conn transaction.Conn, phone string) (*UserWechat, error)
Find(ctx context.Context, conn transaction.Conn, queryOptions map[string]interface{}) (int64, []*UserWechat, error)
}
func (m *UserWechat) Identify() interface{} {
if m.Id == 0 {
return nil
}
return m.Id
}