// 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" "gadmin/internal/gorm/model" ) func newChatMsgLog(db *gorm.DB, opts ...gen.DOOption) chatMsgLog { _chatMsgLog := chatMsgLog{} _chatMsgLog.chatMsgLogDo.UseDB(db, opts...) _chatMsgLog.chatMsgLogDo.UseModel(&model.ChatMsgLog{}) tableName := _chatMsgLog.chatMsgLogDo.TableName() _chatMsgLog.ALL = field.NewAsterisk(tableName) _chatMsgLog.ID = field.NewInt64(tableName, "id") _chatMsgLog.PlayerID = field.NewInt64(tableName, "player_id") _chatMsgLog.NickName = field.NewString(tableName, "nick_name") _chatMsgLog.HeadID = field.NewInt32(tableName, "head_id") _chatMsgLog.FrameID = field.NewInt32(tableName, "frame_id") _chatMsgLog.HeadImg = field.NewString(tableName, "head_img") _chatMsgLog.CreateTime = field.NewInt64(tableName, "create_time") _chatMsgLog.ChatChannel = field.NewInt32(tableName, "chat_channel") _chatMsgLog.ChatID = field.NewString(tableName, "chat_id") _chatMsgLog.Content = field.NewString(tableName, "content") _chatMsgLog.SeverID = field.NewInt32(tableName, "sever_id") _chatMsgLog.ShowType = field.NewInt32(tableName, "show_type") _chatMsgLog.IntParam = field.NewString(tableName, "int_param") _chatMsgLog.StrParam = field.NewString(tableName, "str_param") _chatMsgLog.fillFieldMap() return _chatMsgLog } type chatMsgLog struct { chatMsgLogDo chatMsgLogDo ALL field.Asterisk ID field.Int64 PlayerID field.Int64 // 玩家id NickName field.String // 玩家昵称 HeadID field.Int32 // 头像 -1 代表使用 AvatarURL 微信授权头像 FrameID field.Int32 // 头像框id HeadImg field.String // 头像 CreateTime field.Int64 // 产生时间(毫秒) ChatChannel field.Int32 // 频道类型 ChatID field.String // 聊天Id Content field.String // 聊天内容 [emoji:表情Id] SeverID field.Int32 // 服务器Id ShowType field.Int32 IntParam field.String StrParam field.String fieldMap map[string]field.Expr } func (c chatMsgLog) Table(newTableName string) *chatMsgLog { c.chatMsgLogDo.UseTable(newTableName) return c.updateTableName(newTableName) } func (c chatMsgLog) As(alias string) *chatMsgLog { c.chatMsgLogDo.DO = *(c.chatMsgLogDo.As(alias).(*gen.DO)) return c.updateTableName(alias) } func (c *chatMsgLog) updateTableName(table string) *chatMsgLog { c.ALL = field.NewAsterisk(table) c.ID = field.NewInt64(table, "id") c.PlayerID = field.NewInt64(table, "player_id") c.NickName = field.NewString(table, "nick_name") c.HeadID = field.NewInt32(table, "head_id") c.FrameID = field.NewInt32(table, "frame_id") c.HeadImg = field.NewString(table, "head_img") c.CreateTime = field.NewInt64(table, "create_time") c.ChatChannel = field.NewInt32(table, "chat_channel") c.ChatID = field.NewString(table, "chat_id") c.Content = field.NewString(table, "content") c.SeverID = field.NewInt32(table, "sever_id") c.ShowType = field.NewInt32(table, "show_type") c.IntParam = field.NewString(table, "int_param") c.StrParam = field.NewString(table, "str_param") c.fillFieldMap() return c } func (c *chatMsgLog) WithContext(ctx context.Context) *chatMsgLogDo { return c.chatMsgLogDo.WithContext(ctx) } func (c chatMsgLog) TableName() string { return c.chatMsgLogDo.TableName() } func (c chatMsgLog) Alias() string { return c.chatMsgLogDo.Alias() } func (c chatMsgLog) Columns(cols ...field.Expr) gen.Columns { return c.chatMsgLogDo.Columns(cols...) } func (c *chatMsgLog) GetFieldByName(fieldName string) (field.OrderExpr, bool) { _f, ok := c.fieldMap[fieldName] if !ok || _f == nil { return nil, false } _oe, ok := _f.(field.OrderExpr) return _oe, ok } func (c *chatMsgLog) fillFieldMap() { c.fieldMap = make(map[string]field.Expr, 14) c.fieldMap["id"] = c.ID c.fieldMap["player_id"] = c.PlayerID c.fieldMap["nick_name"] = c.NickName c.fieldMap["head_id"] = c.HeadID c.fieldMap["frame_id"] = c.FrameID c.fieldMap["head_img"] = c.HeadImg c.fieldMap["create_time"] = c.CreateTime c.fieldMap["chat_channel"] = c.ChatChannel c.fieldMap["chat_id"] = c.ChatID c.fieldMap["content"] = c.Content c.fieldMap["sever_id"] = c.SeverID c.fieldMap["show_type"] = c.ShowType c.fieldMap["int_param"] = c.IntParam c.fieldMap["str_param"] = c.StrParam } func (c chatMsgLog) clone(db *gorm.DB) chatMsgLog { c.chatMsgLogDo.ReplaceConnPool(db.Statement.ConnPool) return c } func (c chatMsgLog) replaceDB(db *gorm.DB) chatMsgLog { c.chatMsgLogDo.ReplaceDB(db) return c } type chatMsgLogDo struct{ gen.DO } func (c chatMsgLogDo) Debug() *chatMsgLogDo { return c.withDO(c.DO.Debug()) } func (c chatMsgLogDo) WithContext(ctx context.Context) *chatMsgLogDo { return c.withDO(c.DO.WithContext(ctx)) } func (c chatMsgLogDo) ReadDB() *chatMsgLogDo { return c.Clauses(dbresolver.Read) } func (c chatMsgLogDo) WriteDB() *chatMsgLogDo { return c.Clauses(dbresolver.Write) } func (c chatMsgLogDo) Session(config *gorm.Session) *chatMsgLogDo { return c.withDO(c.DO.Session(config)) } func (c chatMsgLogDo) Clauses(conds ...clause.Expression) *chatMsgLogDo { return c.withDO(c.DO.Clauses(conds...)) } func (c chatMsgLogDo) Returning(value interface{}, columns ...string) *chatMsgLogDo { return c.withDO(c.DO.Returning(value, columns...)) } func (c chatMsgLogDo) Not(conds ...gen.Condition) *chatMsgLogDo { return c.withDO(c.DO.Not(conds...)) } func (c chatMsgLogDo) Or(conds ...gen.Condition) *chatMsgLogDo { return c.withDO(c.DO.Or(conds...)) } func (c chatMsgLogDo) Select(conds ...field.Expr) *chatMsgLogDo { return c.withDO(c.DO.Select(conds...)) } func (c chatMsgLogDo) Where(conds ...gen.Condition) *chatMsgLogDo { return c.withDO(c.DO.Where(conds...)) } func (c chatMsgLogDo) Order(conds ...field.Expr) *chatMsgLogDo { return c.withDO(c.DO.Order(conds...)) } func (c chatMsgLogDo) Distinct(cols ...field.Expr) *chatMsgLogDo { return c.withDO(c.DO.Distinct(cols...)) } func (c chatMsgLogDo) Omit(cols ...field.Expr) *chatMsgLogDo { return c.withDO(c.DO.Omit(cols...)) } func (c chatMsgLogDo) Join(table schema.Tabler, on ...field.Expr) *chatMsgLogDo { return c.withDO(c.DO.Join(table, on...)) } func (c chatMsgLogDo) LeftJoin(table schema.Tabler, on ...field.Expr) *chatMsgLogDo { return c.withDO(c.DO.LeftJoin(table, on...)) } func (c chatMsgLogDo) RightJoin(table schema.Tabler, on ...field.Expr) *chatMsgLogDo { return c.withDO(c.DO.RightJoin(table, on...)) } func (c chatMsgLogDo) Group(cols ...field.Expr) *chatMsgLogDo { return c.withDO(c.DO.Group(cols...)) } func (c chatMsgLogDo) Having(conds ...gen.Condition) *chatMsgLogDo { return c.withDO(c.DO.Having(conds...)) } func (c chatMsgLogDo) Limit(limit int) *chatMsgLogDo { return c.withDO(c.DO.Limit(limit)) } func (c chatMsgLogDo) Offset(offset int) *chatMsgLogDo { return c.withDO(c.DO.Offset(offset)) } func (c chatMsgLogDo) Scopes(funcs ...func(gen.Dao) gen.Dao) *chatMsgLogDo { return c.withDO(c.DO.Scopes(funcs...)) } func (c chatMsgLogDo) Unscoped() *chatMsgLogDo { return c.withDO(c.DO.Unscoped()) } func (c chatMsgLogDo) Create(values ...*model.ChatMsgLog) error { if len(values) == 0 { return nil } return c.DO.Create(values) } func (c chatMsgLogDo) CreateInBatches(values []*model.ChatMsgLog, batchSize int) error { return c.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 (c chatMsgLogDo) Save(values ...*model.ChatMsgLog) error { if len(values) == 0 { return nil } return c.DO.Save(values) } func (c chatMsgLogDo) First() (*model.ChatMsgLog, error) { if result, err := c.DO.First(); err != nil { return nil, err } else { return result.(*model.ChatMsgLog), nil } } func (c chatMsgLogDo) Take() (*model.ChatMsgLog, error) { if result, err := c.DO.Take(); err != nil { return nil, err } else { return result.(*model.ChatMsgLog), nil } } func (c chatMsgLogDo) Last() (*model.ChatMsgLog, error) { if result, err := c.DO.Last(); err != nil { return nil, err } else { return result.(*model.ChatMsgLog), nil } } func (c chatMsgLogDo) Find() ([]*model.ChatMsgLog, error) { result, err := c.DO.Find() return result.([]*model.ChatMsgLog), err } func (c chatMsgLogDo) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*model.ChatMsgLog, err error) { buf := make([]*model.ChatMsgLog, 0, batchSize) err = c.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 (c chatMsgLogDo) FindInBatches(result *[]*model.ChatMsgLog, batchSize int, fc func(tx gen.Dao, batch int) error) error { return c.DO.FindInBatches(result, batchSize, fc) } func (c chatMsgLogDo) Attrs(attrs ...field.AssignExpr) *chatMsgLogDo { return c.withDO(c.DO.Attrs(attrs...)) } func (c chatMsgLogDo) Assign(attrs ...field.AssignExpr) *chatMsgLogDo { return c.withDO(c.DO.Assign(attrs...)) } func (c chatMsgLogDo) Joins(fields ...field.RelationField) *chatMsgLogDo { for _, _f := range fields { c = *c.withDO(c.DO.Joins(_f)) } return &c } func (c chatMsgLogDo) Preload(fields ...field.RelationField) *chatMsgLogDo { for _, _f := range fields { c = *c.withDO(c.DO.Preload(_f)) } return &c } func (c chatMsgLogDo) FirstOrInit() (*model.ChatMsgLog, error) { if result, err := c.DO.FirstOrInit(); err != nil { return nil, err } else { return result.(*model.ChatMsgLog), nil } } func (c chatMsgLogDo) FirstOrCreate() (*model.ChatMsgLog, error) { if result, err := c.DO.FirstOrCreate(); err != nil { return nil, err } else { return result.(*model.ChatMsgLog), nil } } func (c chatMsgLogDo) FindByPage(offset int, limit int) (result []*model.ChatMsgLog, count int64, err error) { result, err = c.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 = c.Offset(-1).Limit(-1).Count() return } func (c chatMsgLogDo) ScanByPage(result interface{}, offset int, limit int) (count int64, err error) { count, err = c.Count() if err != nil { return } err = c.Offset(offset).Limit(limit).Scan(result) return } func (c chatMsgLogDo) Scan(result interface{}) (err error) { return c.DO.Scan(result) } func (c chatMsgLogDo) Delete(models ...*model.ChatMsgLog) (result gen.ResultInfo, err error) { return c.DO.Delete(models) } func (c *chatMsgLogDo) withDO(do gen.Dao) *chatMsgLogDo { c.DO = *do.(*gen.DO) return c }