// 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 dao import ( "context" "gorm.io/gorm" "gorm.io/gorm/clause" "gorm.io/gorm/schema" "gorm.io/gen" "gorm.io/gen/field" "gorm.io/plugin/dbresolver" "git.rtzhtech.cn/iss/public-lib/model" ) func newVideoAction(db *gorm.DB) videoAction { _videoAction := videoAction{} _videoAction.videoActionDo.UseDB(db) _videoAction.videoActionDo.UseModel(&model.VideoAction{}) tableName := _videoAction.videoActionDo.TableName() _videoAction.ALL = field.NewField(tableName, "*") _videoAction.ID = field.NewInt32(tableName, "id") _videoAction.Actid = field.NewInt64(tableName, "actid") _videoAction.Mpid = field.NewInt64(tableName, "mpid") _videoAction.Acttype = field.NewInt32(tableName, "acttype") _videoAction.Actdesc = field.NewInt32(tableName, "actdesc") _videoAction.Value = field.NewInt32(tableName, "value") _videoAction.CreateAt = field.NewTime(tableName, "create_at") _videoAction.UpdateAt = field.NewTime(tableName, "update_at") _videoAction.fillFieldMap() _videoAction.Base = newBase(tableName, db) return _videoAction } type videoAction struct { videoActionDo ALL field.Field ID field.Int32 Actid field.Int64 Mpid field.Int64 Acttype field.Int32 Actdesc field.Int32 Value field.Int32 CreateAt field.Time UpdateAt field.Time fieldMap map[string]field.Expr } func (v videoAction) Table(newTableName string) *videoAction { v.videoActionDo.UseTable(newTableName) return v.updateTableName(newTableName) } func (v videoAction) As(alias string) *videoAction { v.videoActionDo.DO = *(v.videoActionDo.As(alias).(*gen.DO)) return v.updateTableName(alias) } func (v *videoAction) updateTableName(table string) *videoAction { v.ALL = field.NewField(table, "*") v.ID = field.NewInt32(table, "id") v.Actid = field.NewInt64(table, "actid") v.Mpid = field.NewInt64(table, "mpid") v.Acttype = field.NewInt32(table, "acttype") v.Actdesc = field.NewInt32(table, "actdesc") v.Value = field.NewInt32(table, "value") v.CreateAt = field.NewTime(table, "create_at") v.UpdateAt = field.NewTime(table, "update_at") v.fillFieldMap() return v } func (v *videoAction) GetFieldByName(fieldName string) (field.OrderExpr, bool) { _f, ok := v.fieldMap[fieldName] if !ok || _f == nil { return nil, false } _oe, ok := _f.(field.OrderExpr) return _oe, ok } func (v *videoAction) fillFieldMap() { v.fieldMap = make(map[string]field.Expr, 8) v.fieldMap["id"] = v.ID v.fieldMap["actid"] = v.Actid v.fieldMap["mpid"] = v.Mpid v.fieldMap["acttype"] = v.Acttype v.fieldMap["actdesc"] = v.Actdesc v.fieldMap["value"] = v.Value v.fieldMap["create_at"] = v.CreateAt v.fieldMap["update_at"] = v.UpdateAt } func (v videoAction) clone(db *gorm.DB) videoAction { v.videoActionDo.ReplaceDB(db) return v } type videoActionDo struct { gen.DO Base *Base } func (v videoActionDo) Debug() *videoActionDo { return v.withDO(v.DO.Debug()) } func (v videoActionDo) WithContext(ctx context.Context) *videoActionDo { return v.withDO(v.DO.WithContext(ctx)) } func (v videoActionDo) ReadDB() *videoActionDo { return v.Clauses(dbresolver.Read) } func (v videoActionDo) WriteDB() *videoActionDo { return v.Clauses(dbresolver.Write) } func (v videoActionDo) Clauses(conds ...clause.Expression) *videoActionDo { return v.withDO(v.DO.Clauses(conds...)) } func (v videoActionDo) Returning(value interface{}, columns ...string) *videoActionDo { return v.withDO(v.DO.Returning(value, columns...)) } func (v videoActionDo) Not(conds ...gen.Condition) *videoActionDo { return v.withDO(v.DO.Not(conds...)) } func (v videoActionDo) Or(conds ...gen.Condition) *videoActionDo { return v.withDO(v.DO.Or(conds...)) } func (v videoActionDo) Select(conds ...field.Expr) *videoActionDo { return v.withDO(v.DO.Select(conds...)) } func (v videoActionDo) Where(conds ...gen.Condition) *videoActionDo { return v.withDO(v.DO.Where(conds...)) } func (v videoActionDo) Exists(subquery interface{ UnderlyingDB() *gorm.DB }) *videoActionDo { return v.Where(field.CompareSubQuery(field.ExistsOp, nil, subquery.UnderlyingDB())) } func (v videoActionDo) Order(conds ...field.Expr) *videoActionDo { return v.withDO(v.DO.Order(conds...)) } func (v videoActionDo) Distinct(cols ...field.Expr) *videoActionDo { return v.withDO(v.DO.Distinct(cols...)) } func (v videoActionDo) Omit(cols ...field.Expr) *videoActionDo { return v.withDO(v.DO.Omit(cols...)) } func (v videoActionDo) Join(table schema.Tabler, on ...field.Expr) *videoActionDo { return v.withDO(v.DO.Join(table, on...)) } func (v videoActionDo) LeftJoin(table schema.Tabler, on ...field.Expr) *videoActionDo { return v.withDO(v.DO.LeftJoin(table, on...)) } func (v videoActionDo) RightJoin(table schema.Tabler, on ...field.Expr) *videoActionDo { return v.withDO(v.DO.RightJoin(table, on...)) } func (v videoActionDo) Group(cols ...field.Expr) *videoActionDo { return v.withDO(v.DO.Group(cols...)) } func (v videoActionDo) Having(conds ...gen.Condition) *videoActionDo { return v.withDO(v.DO.Having(conds...)) } func (v videoActionDo) Limit(limit int) *videoActionDo { return v.withDO(v.DO.Limit(limit)) } func (v videoActionDo) Offset(offset int) *videoActionDo { return v.withDO(v.DO.Offset(offset)) } func (v videoActionDo) Scopes(funcs ...func(gen.Dao) gen.Dao) *videoActionDo { return v.withDO(v.DO.Scopes(funcs...)) } func (v videoActionDo) Unscoped() *videoActionDo { return v.withDO(v.DO.Unscoped()) } func (v videoActionDo) Create(values ...*model.VideoAction) error { if len(values) == 0 { return nil } return v.DO.Create(values) } func (v videoActionDo) CreateInBatches(values []*model.VideoAction, batchSize int) error { return v.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 (v videoActionDo) Save(values ...*model.VideoAction) error { if len(values) == 0 { return nil } return v.DO.Save(values) } func (v videoActionDo) First() (*model.VideoAction, error) { if result, err := v.DO.First(); err != nil { return nil, err } else { return result.(*model.VideoAction), nil } } func (v videoActionDo) Take() (*model.VideoAction, error) { if result, err := v.DO.Take(); err != nil { return nil, err } else { return result.(*model.VideoAction), nil } } func (v videoActionDo) Last() (*model.VideoAction, error) { if result, err := v.DO.Last(); err != nil { return nil, err } else { return result.(*model.VideoAction), nil } } func (v videoActionDo) Find() ([]*model.VideoAction, error) { result, err := v.DO.Find() return result.([]*model.VideoAction), err } func (v videoActionDo) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*model.VideoAction, err error) { buf := make([]*model.VideoAction, 0, batchSize) err = v.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 (v videoActionDo) FindInBatches(result *[]*model.VideoAction, batchSize int, fc func(tx gen.Dao, batch int) error) error { return v.DO.FindInBatches(result, batchSize, fc) } func (v videoActionDo) Attrs(attrs ...field.AssignExpr) *videoActionDo { return v.withDO(v.DO.Attrs(attrs...)) } func (v videoActionDo) Assign(attrs ...field.AssignExpr) *videoActionDo { return v.withDO(v.DO.Assign(attrs...)) } func (v videoActionDo) Joins(fields ...field.RelationField) *videoActionDo { for _, _f := range fields { v = *v.withDO(v.DO.Joins(_f)) } return &v } func (v videoActionDo) Preload(fields ...field.RelationField) *videoActionDo { for _, _f := range fields { v = *v.withDO(v.DO.Preload(_f)) } return &v } func (v videoActionDo) FirstOrInit() (*model.VideoAction, error) { if result, err := v.DO.FirstOrInit(); err != nil { return nil, err } else { return result.(*model.VideoAction), nil } } func (v videoActionDo) FirstOrCreate() (*model.VideoAction, error) { if result, err := v.DO.FirstOrCreate(); err != nil { return nil, err } else { return result.(*model.VideoAction), nil } } func (v videoActionDo) FindByPage(offset int, limit int) (result []*model.VideoAction, count int64, err error) { result, err = v.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 = v.Offset(-1).Limit(-1).Count() return } func (v videoActionDo) ScanByPage(result interface{}, offset int, limit int) (count int64, err error) { count, err = v.Count() if err != nil { return } err = v.Offset(offset).Limit(limit).Scan(result) return } func (v videoActionDo) Scan(result interface{}) (err error) { return v.DO.Scan(result) } func (v videoActionDo) Delete(models ...*model.VideoAction) (result gen.ResultInfo, err error) { return v.DO.Delete(models) } func (v *videoActionDo) withDO(do gen.Dao) *videoActionDo { v.DO = *do.(*gen.DO) return v }