// 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 newNewConvLog(db *gorm.DB, opts ...gen.DOOption) newConvLog { _newConvLog := newConvLog{} _newConvLog.newConvLogDo.UseDB(db, opts...) _newConvLog.newConvLogDo.UseModel(&model.NewConvLog{}) tableName := _newConvLog.newConvLogDo.TableName() _newConvLog.ALL = field.NewAsterisk(tableName) _newConvLog.ID = field.NewInt64(tableName, "id") _newConvLog.Userid = field.NewInt64(tableName, "userid") _newConvLog.ServerID = field.NewInt32(tableName, "server_id") _newConvLog.EventID = field.NewInt32(tableName, "event_id") _newConvLog.Date = field.NewString(tableName, "date") _newConvLog.EventAt = field.NewInt32(tableName, "event_at") _newConvLog.EventAtNs = field.NewInt64(tableName, "event_at_ns") _newConvLog.fillFieldMap() return _newConvLog } type newConvLog struct { newConvLogDo ALL field.Asterisk ID field.Int64 Userid field.Int64 // 用户ID ServerID field.Int32 // 服务器ID EventID field.Int32 // 事件ID Date field.String EventAt field.Int32 // 触发时间戳 EventAtNs field.Int64 // 发生时间ns fieldMap map[string]field.Expr } func (n newConvLog) Table(newTableName string) *newConvLog { n.newConvLogDo.UseTable(newTableName) return n.updateTableName(newTableName) } func (n newConvLog) As(alias string) *newConvLog { n.newConvLogDo.DO = *(n.newConvLogDo.As(alias).(*gen.DO)) return n.updateTableName(alias) } func (n *newConvLog) updateTableName(table string) *newConvLog { n.ALL = field.NewAsterisk(table) n.ID = field.NewInt64(table, "id") n.Userid = field.NewInt64(table, "userid") n.ServerID = field.NewInt32(table, "server_id") n.EventID = field.NewInt32(table, "event_id") n.Date = field.NewString(table, "date") n.EventAt = field.NewInt32(table, "event_at") n.EventAtNs = field.NewInt64(table, "event_at_ns") n.fillFieldMap() return n } func (n *newConvLog) GetFieldByName(fieldName string) (field.OrderExpr, bool) { _f, ok := n.fieldMap[fieldName] if !ok || _f == nil { return nil, false } _oe, ok := _f.(field.OrderExpr) return _oe, ok } func (n *newConvLog) fillFieldMap() { n.fieldMap = make(map[string]field.Expr, 7) n.fieldMap["id"] = n.ID n.fieldMap["userid"] = n.Userid n.fieldMap["server_id"] = n.ServerID n.fieldMap["event_id"] = n.EventID n.fieldMap["date"] = n.Date n.fieldMap["event_at"] = n.EventAt n.fieldMap["event_at_ns"] = n.EventAtNs } func (n newConvLog) clone(db *gorm.DB) newConvLog { n.newConvLogDo.ReplaceConnPool(db.Statement.ConnPool) return n } func (n newConvLog) replaceDB(db *gorm.DB) newConvLog { n.newConvLogDo.ReplaceDB(db) return n } type newConvLogDo struct{ gen.DO } func (n newConvLogDo) Debug() *newConvLogDo { return n.withDO(n.DO.Debug()) } func (n newConvLogDo) WithContext(ctx context.Context) *newConvLogDo { return n.withDO(n.DO.WithContext(ctx)) } func (n newConvLogDo) ReadDB() *newConvLogDo { return n.Clauses(dbresolver.Read) } func (n newConvLogDo) WriteDB() *newConvLogDo { return n.Clauses(dbresolver.Write) } func (n newConvLogDo) Session(config *gorm.Session) *newConvLogDo { return n.withDO(n.DO.Session(config)) } func (n newConvLogDo) Clauses(conds ...clause.Expression) *newConvLogDo { return n.withDO(n.DO.Clauses(conds...)) } func (n newConvLogDo) Returning(value interface{}, columns ...string) *newConvLogDo { return n.withDO(n.DO.Returning(value, columns...)) } func (n newConvLogDo) Not(conds ...gen.Condition) *newConvLogDo { return n.withDO(n.DO.Not(conds...)) } func (n newConvLogDo) Or(conds ...gen.Condition) *newConvLogDo { return n.withDO(n.DO.Or(conds...)) } func (n newConvLogDo) Select(conds ...field.Expr) *newConvLogDo { return n.withDO(n.DO.Select(conds...)) } func (n newConvLogDo) Where(conds ...gen.Condition) *newConvLogDo { return n.withDO(n.DO.Where(conds...)) } func (n newConvLogDo) Exists(subquery interface{ UnderlyingDB() *gorm.DB }) *newConvLogDo { return n.Where(field.CompareSubQuery(field.ExistsOp, nil, subquery.UnderlyingDB())) } func (n newConvLogDo) Order(conds ...field.Expr) *newConvLogDo { return n.withDO(n.DO.Order(conds...)) } func (n newConvLogDo) Distinct(cols ...field.Expr) *newConvLogDo { return n.withDO(n.DO.Distinct(cols...)) } func (n newConvLogDo) Omit(cols ...field.Expr) *newConvLogDo { return n.withDO(n.DO.Omit(cols...)) } func (n newConvLogDo) Join(table schema.Tabler, on ...field.Expr) *newConvLogDo { return n.withDO(n.DO.Join(table, on...)) } func (n newConvLogDo) LeftJoin(table schema.Tabler, on ...field.Expr) *newConvLogDo { return n.withDO(n.DO.LeftJoin(table, on...)) } func (n newConvLogDo) RightJoin(table schema.Tabler, on ...field.Expr) *newConvLogDo { return n.withDO(n.DO.RightJoin(table, on...)) } func (n newConvLogDo) Group(cols ...field.Expr) *newConvLogDo { return n.withDO(n.DO.Group(cols...)) } func (n newConvLogDo) Having(conds ...gen.Condition) *newConvLogDo { return n.withDO(n.DO.Having(conds...)) } func (n newConvLogDo) Limit(limit int) *newConvLogDo { return n.withDO(n.DO.Limit(limit)) } func (n newConvLogDo) Offset(offset int) *newConvLogDo { return n.withDO(n.DO.Offset(offset)) } func (n newConvLogDo) Scopes(funcs ...func(gen.Dao) gen.Dao) *newConvLogDo { return n.withDO(n.DO.Scopes(funcs...)) } func (n newConvLogDo) Unscoped() *newConvLogDo { return n.withDO(n.DO.Unscoped()) } func (n newConvLogDo) Create(values ...*model.NewConvLog) error { if len(values) == 0 { return nil } return n.DO.Create(values) } func (n newConvLogDo) CreateInBatches(values []*model.NewConvLog, batchSize int) error { return n.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 (n newConvLogDo) Save(values ...*model.NewConvLog) error { if len(values) == 0 { return nil } return n.DO.Save(values) } func (n newConvLogDo) First() (*model.NewConvLog, error) { if result, err := n.DO.First(); err != nil { return nil, err } else { return result.(*model.NewConvLog), nil } } func (n newConvLogDo) Take() (*model.NewConvLog, error) { if result, err := n.DO.Take(); err != nil { return nil, err } else { return result.(*model.NewConvLog), nil } } func (n newConvLogDo) Last() (*model.NewConvLog, error) { if result, err := n.DO.Last(); err != nil { return nil, err } else { return result.(*model.NewConvLog), nil } } func (n newConvLogDo) Find() ([]*model.NewConvLog, error) { result, err := n.DO.Find() return result.([]*model.NewConvLog), err } func (n newConvLogDo) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*model.NewConvLog, err error) { buf := make([]*model.NewConvLog, 0, batchSize) err = n.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 (n newConvLogDo) FindInBatches(result *[]*model.NewConvLog, batchSize int, fc func(tx gen.Dao, batch int) error) error { return n.DO.FindInBatches(result, batchSize, fc) } func (n newConvLogDo) Attrs(attrs ...field.AssignExpr) *newConvLogDo { return n.withDO(n.DO.Attrs(attrs...)) } func (n newConvLogDo) Assign(attrs ...field.AssignExpr) *newConvLogDo { return n.withDO(n.DO.Assign(attrs...)) } func (n newConvLogDo) Joins(fields ...field.RelationField) *newConvLogDo { for _, _f := range fields { n = *n.withDO(n.DO.Joins(_f)) } return &n } func (n newConvLogDo) Preload(fields ...field.RelationField) *newConvLogDo { for _, _f := range fields { n = *n.withDO(n.DO.Preload(_f)) } return &n } func (n newConvLogDo) FirstOrInit() (*model.NewConvLog, error) { if result, err := n.DO.FirstOrInit(); err != nil { return nil, err } else { return result.(*model.NewConvLog), nil } } func (n newConvLogDo) FirstOrCreate() (*model.NewConvLog, error) { if result, err := n.DO.FirstOrCreate(); err != nil { return nil, err } else { return result.(*model.NewConvLog), nil } } func (n newConvLogDo) FindByPage(offset int, limit int) (result []*model.NewConvLog, count int64, err error) { result, err = n.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 = n.Offset(-1).Limit(-1).Count() return } func (n newConvLogDo) ScanByPage(result interface{}, offset int, limit int) (count int64, err error) { count, err = n.Count() if err != nil { return } err = n.Offset(offset).Limit(limit).Scan(result) return } func (n newConvLogDo) Scan(result interface{}) (err error) { return n.DO.Scan(result) } func (n newConvLogDo) Delete(models ...*model.NewConvLog) (result gen.ResultInfo, err error) { return n.DO.Delete(models) } func (n *newConvLogDo) withDO(do gen.Dao) *newConvLogDo { n.DO = *do.(*gen.DO) return n }