461 lines
15 KiB
Go
461 lines
15 KiB
Go
// Code generated by gorm.io/gen. DO NOT EDIT.
|
|
// Code generated by gorm.io/gen. DO NOT EDIT.
|
|
// Code generated by gorm.io/gen. DO NOT EDIT.
|
|
|
|
package query
|
|
|
|
import (
|
|
"context"
|
|
|
|
"gorm.io/gorm"
|
|
"gorm.io/gorm/clause"
|
|
"gorm.io/gorm/schema"
|
|
|
|
"gorm.io/gen"
|
|
"gorm.io/gen/field"
|
|
|
|
"gorm.io/plugin/dbresolver"
|
|
|
|
"schisandra-album-cloud-microservices/app/auth/model/mysql/model"
|
|
)
|
|
|
|
func newScaCommentReply(db *gorm.DB, opts ...gen.DOOption) scaCommentReply {
|
|
_scaCommentReply := scaCommentReply{}
|
|
|
|
_scaCommentReply.scaCommentReplyDo.UseDB(db, opts...)
|
|
_scaCommentReply.scaCommentReplyDo.UseModel(&model.ScaCommentReply{})
|
|
|
|
tableName := _scaCommentReply.scaCommentReplyDo.TableName()
|
|
_scaCommentReply.ALL = field.NewAsterisk(tableName)
|
|
_scaCommentReply.ID = field.NewInt64(tableName, "id")
|
|
_scaCommentReply.UserID = field.NewString(tableName, "user_id")
|
|
_scaCommentReply.TopicID = field.NewString(tableName, "topic_id")
|
|
_scaCommentReply.TopicType = field.NewInt64(tableName, "topic_type")
|
|
_scaCommentReply.Content = field.NewString(tableName, "content")
|
|
_scaCommentReply.CommentType = field.NewInt64(tableName, "comment_type")
|
|
_scaCommentReply.ReplyTo = field.NewInt64(tableName, "reply_to")
|
|
_scaCommentReply.ReplyID = field.NewInt64(tableName, "reply_id")
|
|
_scaCommentReply.ReplyUser = field.NewString(tableName, "reply_user")
|
|
_scaCommentReply.Author = field.NewInt64(tableName, "author")
|
|
_scaCommentReply.Likes = field.NewInt64(tableName, "likes")
|
|
_scaCommentReply.ReplyCount = field.NewInt64(tableName, "reply_count")
|
|
_scaCommentReply.Browser = field.NewString(tableName, "browser")
|
|
_scaCommentReply.OperatingSystem = field.NewString(tableName, "operating_system")
|
|
_scaCommentReply.CommentIP = field.NewString(tableName, "comment_ip")
|
|
_scaCommentReply.Location = field.NewString(tableName, "location")
|
|
_scaCommentReply.Agent = field.NewString(tableName, "agent")
|
|
_scaCommentReply.CreatedAt = field.NewTime(tableName, "created_at")
|
|
_scaCommentReply.UpdatedAt = field.NewTime(tableName, "updated_at")
|
|
_scaCommentReply.Version = field.NewField(tableName, "version")
|
|
_scaCommentReply.DeletedAt = field.NewField(tableName, "deleted_at")
|
|
|
|
_scaCommentReply.fillFieldMap()
|
|
|
|
return _scaCommentReply
|
|
}
|
|
|
|
type scaCommentReply struct {
|
|
scaCommentReplyDo
|
|
|
|
ALL field.Asterisk
|
|
ID field.Int64 // 主键id
|
|
UserID field.String // 评论用户id
|
|
TopicID field.String // 评论话题id
|
|
TopicType field.Int64 // 话题类型
|
|
Content field.String // 评论内容
|
|
CommentType field.Int64 // 评论类型 0评论 1 回复
|
|
ReplyTo field.Int64 // 回复子评论ID
|
|
ReplyID field.Int64 // 回复父评论Id
|
|
ReplyUser field.String // 回复人id
|
|
Author field.Int64 // 评论回复是否作者 0否 1是
|
|
Likes field.Int64 // 点赞数
|
|
ReplyCount field.Int64 // 回复数量
|
|
Browser field.String // 浏览器
|
|
OperatingSystem field.String // 操作系统
|
|
CommentIP field.String // IP地址
|
|
Location field.String // 地址
|
|
Agent field.String // 设备信息
|
|
CreatedAt field.Time // 创建时间
|
|
UpdatedAt field.Time // 更新时间
|
|
Version field.Field // 版本
|
|
DeletedAt field.Field // 删除时间
|
|
|
|
fieldMap map[string]field.Expr
|
|
}
|
|
|
|
func (s scaCommentReply) Table(newTableName string) *scaCommentReply {
|
|
s.scaCommentReplyDo.UseTable(newTableName)
|
|
return s.updateTableName(newTableName)
|
|
}
|
|
|
|
func (s scaCommentReply) As(alias string) *scaCommentReply {
|
|
s.scaCommentReplyDo.DO = *(s.scaCommentReplyDo.As(alias).(*gen.DO))
|
|
return s.updateTableName(alias)
|
|
}
|
|
|
|
func (s *scaCommentReply) updateTableName(table string) *scaCommentReply {
|
|
s.ALL = field.NewAsterisk(table)
|
|
s.ID = field.NewInt64(table, "id")
|
|
s.UserID = field.NewString(table, "user_id")
|
|
s.TopicID = field.NewString(table, "topic_id")
|
|
s.TopicType = field.NewInt64(table, "topic_type")
|
|
s.Content = field.NewString(table, "content")
|
|
s.CommentType = field.NewInt64(table, "comment_type")
|
|
s.ReplyTo = field.NewInt64(table, "reply_to")
|
|
s.ReplyID = field.NewInt64(table, "reply_id")
|
|
s.ReplyUser = field.NewString(table, "reply_user")
|
|
s.Author = field.NewInt64(table, "author")
|
|
s.Likes = field.NewInt64(table, "likes")
|
|
s.ReplyCount = field.NewInt64(table, "reply_count")
|
|
s.Browser = field.NewString(table, "browser")
|
|
s.OperatingSystem = field.NewString(table, "operating_system")
|
|
s.CommentIP = field.NewString(table, "comment_ip")
|
|
s.Location = field.NewString(table, "location")
|
|
s.Agent = field.NewString(table, "agent")
|
|
s.CreatedAt = field.NewTime(table, "created_at")
|
|
s.UpdatedAt = field.NewTime(table, "updated_at")
|
|
s.Version = field.NewField(table, "version")
|
|
s.DeletedAt = field.NewField(table, "deleted_at")
|
|
|
|
s.fillFieldMap()
|
|
|
|
return s
|
|
}
|
|
|
|
func (s *scaCommentReply) GetFieldByName(fieldName string) (field.OrderExpr, bool) {
|
|
_f, ok := s.fieldMap[fieldName]
|
|
if !ok || _f == nil {
|
|
return nil, false
|
|
}
|
|
_oe, ok := _f.(field.OrderExpr)
|
|
return _oe, ok
|
|
}
|
|
|
|
func (s *scaCommentReply) fillFieldMap() {
|
|
s.fieldMap = make(map[string]field.Expr, 21)
|
|
s.fieldMap["id"] = s.ID
|
|
s.fieldMap["user_id"] = s.UserID
|
|
s.fieldMap["topic_id"] = s.TopicID
|
|
s.fieldMap["topic_type"] = s.TopicType
|
|
s.fieldMap["content"] = s.Content
|
|
s.fieldMap["comment_type"] = s.CommentType
|
|
s.fieldMap["reply_to"] = s.ReplyTo
|
|
s.fieldMap["reply_id"] = s.ReplyID
|
|
s.fieldMap["reply_user"] = s.ReplyUser
|
|
s.fieldMap["author"] = s.Author
|
|
s.fieldMap["likes"] = s.Likes
|
|
s.fieldMap["reply_count"] = s.ReplyCount
|
|
s.fieldMap["browser"] = s.Browser
|
|
s.fieldMap["operating_system"] = s.OperatingSystem
|
|
s.fieldMap["comment_ip"] = s.CommentIP
|
|
s.fieldMap["location"] = s.Location
|
|
s.fieldMap["agent"] = s.Agent
|
|
s.fieldMap["created_at"] = s.CreatedAt
|
|
s.fieldMap["updated_at"] = s.UpdatedAt
|
|
s.fieldMap["version"] = s.Version
|
|
s.fieldMap["deleted_at"] = s.DeletedAt
|
|
}
|
|
|
|
func (s scaCommentReply) clone(db *gorm.DB) scaCommentReply {
|
|
s.scaCommentReplyDo.ReplaceConnPool(db.Statement.ConnPool)
|
|
return s
|
|
}
|
|
|
|
func (s scaCommentReply) replaceDB(db *gorm.DB) scaCommentReply {
|
|
s.scaCommentReplyDo.ReplaceDB(db)
|
|
return s
|
|
}
|
|
|
|
type scaCommentReplyDo struct{ gen.DO }
|
|
|
|
type IScaCommentReplyDo interface {
|
|
gen.SubQuery
|
|
Debug() IScaCommentReplyDo
|
|
WithContext(ctx context.Context) IScaCommentReplyDo
|
|
WithResult(fc func(tx gen.Dao)) gen.ResultInfo
|
|
ReplaceDB(db *gorm.DB)
|
|
ReadDB() IScaCommentReplyDo
|
|
WriteDB() IScaCommentReplyDo
|
|
As(alias string) gen.Dao
|
|
Session(config *gorm.Session) IScaCommentReplyDo
|
|
Columns(cols ...field.Expr) gen.Columns
|
|
Clauses(conds ...clause.Expression) IScaCommentReplyDo
|
|
Not(conds ...gen.Condition) IScaCommentReplyDo
|
|
Or(conds ...gen.Condition) IScaCommentReplyDo
|
|
Select(conds ...field.Expr) IScaCommentReplyDo
|
|
Where(conds ...gen.Condition) IScaCommentReplyDo
|
|
Order(conds ...field.Expr) IScaCommentReplyDo
|
|
Distinct(cols ...field.Expr) IScaCommentReplyDo
|
|
Omit(cols ...field.Expr) IScaCommentReplyDo
|
|
Join(table schema.Tabler, on ...field.Expr) IScaCommentReplyDo
|
|
LeftJoin(table schema.Tabler, on ...field.Expr) IScaCommentReplyDo
|
|
RightJoin(table schema.Tabler, on ...field.Expr) IScaCommentReplyDo
|
|
Group(cols ...field.Expr) IScaCommentReplyDo
|
|
Having(conds ...gen.Condition) IScaCommentReplyDo
|
|
Limit(limit int) IScaCommentReplyDo
|
|
Offset(offset int) IScaCommentReplyDo
|
|
Count() (count int64, err error)
|
|
Scopes(funcs ...func(gen.Dao) gen.Dao) IScaCommentReplyDo
|
|
Unscoped() IScaCommentReplyDo
|
|
Create(values ...*model.ScaCommentReply) error
|
|
CreateInBatches(values []*model.ScaCommentReply, batchSize int) error
|
|
Save(values ...*model.ScaCommentReply) error
|
|
First() (*model.ScaCommentReply, error)
|
|
Take() (*model.ScaCommentReply, error)
|
|
Last() (*model.ScaCommentReply, error)
|
|
Find() ([]*model.ScaCommentReply, error)
|
|
FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*model.ScaCommentReply, err error)
|
|
FindInBatches(result *[]*model.ScaCommentReply, batchSize int, fc func(tx gen.Dao, batch int) error) error
|
|
Pluck(column field.Expr, dest interface{}) error
|
|
Delete(...*model.ScaCommentReply) (info gen.ResultInfo, err error)
|
|
Update(column field.Expr, value interface{}) (info gen.ResultInfo, err error)
|
|
UpdateSimple(columns ...field.AssignExpr) (info gen.ResultInfo, err error)
|
|
Updates(value interface{}) (info gen.ResultInfo, err error)
|
|
UpdateColumn(column field.Expr, value interface{}) (info gen.ResultInfo, err error)
|
|
UpdateColumnSimple(columns ...field.AssignExpr) (info gen.ResultInfo, err error)
|
|
UpdateColumns(value interface{}) (info gen.ResultInfo, err error)
|
|
UpdateFrom(q gen.SubQuery) gen.Dao
|
|
Attrs(attrs ...field.AssignExpr) IScaCommentReplyDo
|
|
Assign(attrs ...field.AssignExpr) IScaCommentReplyDo
|
|
Joins(fields ...field.RelationField) IScaCommentReplyDo
|
|
Preload(fields ...field.RelationField) IScaCommentReplyDo
|
|
FirstOrInit() (*model.ScaCommentReply, error)
|
|
FirstOrCreate() (*model.ScaCommentReply, error)
|
|
FindByPage(offset int, limit int) (result []*model.ScaCommentReply, count int64, err error)
|
|
ScanByPage(result interface{}, offset int, limit int) (count int64, err error)
|
|
Scan(result interface{}) (err error)
|
|
Returning(value interface{}, columns ...string) IScaCommentReplyDo
|
|
UnderlyingDB() *gorm.DB
|
|
schema.Tabler
|
|
}
|
|
|
|
func (s scaCommentReplyDo) Debug() IScaCommentReplyDo {
|
|
return s.withDO(s.DO.Debug())
|
|
}
|
|
|
|
func (s scaCommentReplyDo) WithContext(ctx context.Context) IScaCommentReplyDo {
|
|
return s.withDO(s.DO.WithContext(ctx))
|
|
}
|
|
|
|
func (s scaCommentReplyDo) ReadDB() IScaCommentReplyDo {
|
|
return s.Clauses(dbresolver.Read)
|
|
}
|
|
|
|
func (s scaCommentReplyDo) WriteDB() IScaCommentReplyDo {
|
|
return s.Clauses(dbresolver.Write)
|
|
}
|
|
|
|
func (s scaCommentReplyDo) Session(config *gorm.Session) IScaCommentReplyDo {
|
|
return s.withDO(s.DO.Session(config))
|
|
}
|
|
|
|
func (s scaCommentReplyDo) Clauses(conds ...clause.Expression) IScaCommentReplyDo {
|
|
return s.withDO(s.DO.Clauses(conds...))
|
|
}
|
|
|
|
func (s scaCommentReplyDo) Returning(value interface{}, columns ...string) IScaCommentReplyDo {
|
|
return s.withDO(s.DO.Returning(value, columns...))
|
|
}
|
|
|
|
func (s scaCommentReplyDo) Not(conds ...gen.Condition) IScaCommentReplyDo {
|
|
return s.withDO(s.DO.Not(conds...))
|
|
}
|
|
|
|
func (s scaCommentReplyDo) Or(conds ...gen.Condition) IScaCommentReplyDo {
|
|
return s.withDO(s.DO.Or(conds...))
|
|
}
|
|
|
|
func (s scaCommentReplyDo) Select(conds ...field.Expr) IScaCommentReplyDo {
|
|
return s.withDO(s.DO.Select(conds...))
|
|
}
|
|
|
|
func (s scaCommentReplyDo) Where(conds ...gen.Condition) IScaCommentReplyDo {
|
|
return s.withDO(s.DO.Where(conds...))
|
|
}
|
|
|
|
func (s scaCommentReplyDo) Order(conds ...field.Expr) IScaCommentReplyDo {
|
|
return s.withDO(s.DO.Order(conds...))
|
|
}
|
|
|
|
func (s scaCommentReplyDo) Distinct(cols ...field.Expr) IScaCommentReplyDo {
|
|
return s.withDO(s.DO.Distinct(cols...))
|
|
}
|
|
|
|
func (s scaCommentReplyDo) Omit(cols ...field.Expr) IScaCommentReplyDo {
|
|
return s.withDO(s.DO.Omit(cols...))
|
|
}
|
|
|
|
func (s scaCommentReplyDo) Join(table schema.Tabler, on ...field.Expr) IScaCommentReplyDo {
|
|
return s.withDO(s.DO.Join(table, on...))
|
|
}
|
|
|
|
func (s scaCommentReplyDo) LeftJoin(table schema.Tabler, on ...field.Expr) IScaCommentReplyDo {
|
|
return s.withDO(s.DO.LeftJoin(table, on...))
|
|
}
|
|
|
|
func (s scaCommentReplyDo) RightJoin(table schema.Tabler, on ...field.Expr) IScaCommentReplyDo {
|
|
return s.withDO(s.DO.RightJoin(table, on...))
|
|
}
|
|
|
|
func (s scaCommentReplyDo) Group(cols ...field.Expr) IScaCommentReplyDo {
|
|
return s.withDO(s.DO.Group(cols...))
|
|
}
|
|
|
|
func (s scaCommentReplyDo) Having(conds ...gen.Condition) IScaCommentReplyDo {
|
|
return s.withDO(s.DO.Having(conds...))
|
|
}
|
|
|
|
func (s scaCommentReplyDo) Limit(limit int) IScaCommentReplyDo {
|
|
return s.withDO(s.DO.Limit(limit))
|
|
}
|
|
|
|
func (s scaCommentReplyDo) Offset(offset int) IScaCommentReplyDo {
|
|
return s.withDO(s.DO.Offset(offset))
|
|
}
|
|
|
|
func (s scaCommentReplyDo) Scopes(funcs ...func(gen.Dao) gen.Dao) IScaCommentReplyDo {
|
|
return s.withDO(s.DO.Scopes(funcs...))
|
|
}
|
|
|
|
func (s scaCommentReplyDo) Unscoped() IScaCommentReplyDo {
|
|
return s.withDO(s.DO.Unscoped())
|
|
}
|
|
|
|
func (s scaCommentReplyDo) Create(values ...*model.ScaCommentReply) error {
|
|
if len(values) == 0 {
|
|
return nil
|
|
}
|
|
return s.DO.Create(values)
|
|
}
|
|
|
|
func (s scaCommentReplyDo) CreateInBatches(values []*model.ScaCommentReply, batchSize int) error {
|
|
return s.DO.CreateInBatches(values, batchSize)
|
|
}
|
|
|
|
// Save : !!! underlying implementation is different with GORM
|
|
// The method is equivalent to executing the statement: db.Clauses(clause.OnConflict{UpdateAll: true}).Create(values)
|
|
func (s scaCommentReplyDo) Save(values ...*model.ScaCommentReply) error {
|
|
if len(values) == 0 {
|
|
return nil
|
|
}
|
|
return s.DO.Save(values)
|
|
}
|
|
|
|
func (s scaCommentReplyDo) First() (*model.ScaCommentReply, error) {
|
|
if result, err := s.DO.First(); err != nil {
|
|
return nil, err
|
|
} else {
|
|
return result.(*model.ScaCommentReply), nil
|
|
}
|
|
}
|
|
|
|
func (s scaCommentReplyDo) Take() (*model.ScaCommentReply, error) {
|
|
if result, err := s.DO.Take(); err != nil {
|
|
return nil, err
|
|
} else {
|
|
return result.(*model.ScaCommentReply), nil
|
|
}
|
|
}
|
|
|
|
func (s scaCommentReplyDo) Last() (*model.ScaCommentReply, error) {
|
|
if result, err := s.DO.Last(); err != nil {
|
|
return nil, err
|
|
} else {
|
|
return result.(*model.ScaCommentReply), nil
|
|
}
|
|
}
|
|
|
|
func (s scaCommentReplyDo) Find() ([]*model.ScaCommentReply, error) {
|
|
result, err := s.DO.Find()
|
|
return result.([]*model.ScaCommentReply), err
|
|
}
|
|
|
|
func (s scaCommentReplyDo) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*model.ScaCommentReply, err error) {
|
|
buf := make([]*model.ScaCommentReply, 0, batchSize)
|
|
err = s.DO.FindInBatches(&buf, batchSize, func(tx gen.Dao, batch int) error {
|
|
defer func() { results = append(results, buf...) }()
|
|
return fc(tx, batch)
|
|
})
|
|
return results, err
|
|
}
|
|
|
|
func (s scaCommentReplyDo) FindInBatches(result *[]*model.ScaCommentReply, batchSize int, fc func(tx gen.Dao, batch int) error) error {
|
|
return s.DO.FindInBatches(result, batchSize, fc)
|
|
}
|
|
|
|
func (s scaCommentReplyDo) Attrs(attrs ...field.AssignExpr) IScaCommentReplyDo {
|
|
return s.withDO(s.DO.Attrs(attrs...))
|
|
}
|
|
|
|
func (s scaCommentReplyDo) Assign(attrs ...field.AssignExpr) IScaCommentReplyDo {
|
|
return s.withDO(s.DO.Assign(attrs...))
|
|
}
|
|
|
|
func (s scaCommentReplyDo) Joins(fields ...field.RelationField) IScaCommentReplyDo {
|
|
for _, _f := range fields {
|
|
s = *s.withDO(s.DO.Joins(_f))
|
|
}
|
|
return &s
|
|
}
|
|
|
|
func (s scaCommentReplyDo) Preload(fields ...field.RelationField) IScaCommentReplyDo {
|
|
for _, _f := range fields {
|
|
s = *s.withDO(s.DO.Preload(_f))
|
|
}
|
|
return &s
|
|
}
|
|
|
|
func (s scaCommentReplyDo) FirstOrInit() (*model.ScaCommentReply, error) {
|
|
if result, err := s.DO.FirstOrInit(); err != nil {
|
|
return nil, err
|
|
} else {
|
|
return result.(*model.ScaCommentReply), nil
|
|
}
|
|
}
|
|
|
|
func (s scaCommentReplyDo) FirstOrCreate() (*model.ScaCommentReply, error) {
|
|
if result, err := s.DO.FirstOrCreate(); err != nil {
|
|
return nil, err
|
|
} else {
|
|
return result.(*model.ScaCommentReply), nil
|
|
}
|
|
}
|
|
|
|
func (s scaCommentReplyDo) FindByPage(offset int, limit int) (result []*model.ScaCommentReply, count int64, err error) {
|
|
result, err = s.Offset(offset).Limit(limit).Find()
|
|
if err != nil {
|
|
return
|
|
}
|
|
|
|
if size := len(result); 0 < limit && 0 < size && size < limit {
|
|
count = int64(size + offset)
|
|
return
|
|
}
|
|
|
|
count, err = s.Offset(-1).Limit(-1).Count()
|
|
return
|
|
}
|
|
|
|
func (s scaCommentReplyDo) ScanByPage(result interface{}, offset int, limit int) (count int64, err error) {
|
|
count, err = s.Count()
|
|
if err != nil {
|
|
return
|
|
}
|
|
|
|
err = s.Offset(offset).Limit(limit).Scan(result)
|
|
return
|
|
}
|
|
|
|
func (s scaCommentReplyDo) Scan(result interface{}) (err error) {
|
|
return s.DO.Scan(result)
|
|
}
|
|
|
|
func (s scaCommentReplyDo) Delete(models ...*model.ScaCommentReply) (result gen.ResultInfo, err error) {
|
|
return s.DO.Delete(models)
|
|
}
|
|
|
|
func (s *scaCommentReplyDo) withDO(do gen.Dao) *scaCommentReplyDo {
|
|
s.DO = *do.(*gen.DO)
|
|
return s
|
|
}
|