// 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" "bindbox-game/internal/repository/mysql/model" ) func newRoleActions(db *gorm.DB, opts ...gen.DOOption) roleActions { _roleActions := roleActions{} _roleActions.roleActionsDo.UseDB(db, opts...) _roleActions.roleActionsDo.UseModel(&model.RoleActions{}) tableName := _roleActions.roleActionsDo.TableName() _roleActions.ALL = field.NewAsterisk(tableName) _roleActions.ID = field.NewInt64(tableName, "id") _roleActions.RoleID = field.NewInt64(tableName, "role_id") _roleActions.ActionID = field.NewInt64(tableName, "action_id") _roleActions.CreatedUser = field.NewString(tableName, "created_user") _roleActions.UpdatedUser = field.NewString(tableName, "updated_user") _roleActions.CreatedAt = field.NewTime(tableName, "created_at") _roleActions.UpdatedAt = field.NewTime(tableName, "updated_at") _roleActions.fillFieldMap() return _roleActions } type roleActions struct { roleActionsDo ALL field.Asterisk ID field.Int64 RoleID field.Int64 ActionID field.Int64 CreatedUser field.String UpdatedUser field.String CreatedAt field.Time UpdatedAt field.Time fieldMap map[string]field.Expr } func (r roleActions) Table(newTableName string) *roleActions { r.roleActionsDo.UseTable(newTableName) return r.updateTableName(newTableName) } func (r roleActions) As(alias string) *roleActions { r.roleActionsDo.DO = *(r.roleActionsDo.As(alias).(*gen.DO)) return r.updateTableName(alias) } func (r *roleActions) updateTableName(table string) *roleActions { r.ALL = field.NewAsterisk(table) r.ID = field.NewInt64(table, "id") r.RoleID = field.NewInt64(table, "role_id") r.ActionID = field.NewInt64(table, "action_id") r.CreatedUser = field.NewString(table, "created_user") r.UpdatedUser = field.NewString(table, "updated_user") r.CreatedAt = field.NewTime(table, "created_at") r.UpdatedAt = field.NewTime(table, "updated_at") r.fillFieldMap() return r } func (r *roleActions) GetFieldByName(fieldName string) (field.OrderExpr, bool) { _f, ok := r.fieldMap[fieldName] if !ok || _f == nil { return nil, false } _oe, ok := _f.(field.OrderExpr) return _oe, ok } func (r *roleActions) fillFieldMap() { r.fieldMap = make(map[string]field.Expr, 7) r.fieldMap["id"] = r.ID r.fieldMap["role_id"] = r.RoleID r.fieldMap["action_id"] = r.ActionID r.fieldMap["created_user"] = r.CreatedUser r.fieldMap["updated_user"] = r.UpdatedUser r.fieldMap["created_at"] = r.CreatedAt r.fieldMap["updated_at"] = r.UpdatedAt } func (r roleActions) clone(db *gorm.DB) roleActions { r.roleActionsDo.ReplaceConnPool(db.Statement.ConnPool) return r } func (r roleActions) replaceDB(db *gorm.DB) roleActions { r.roleActionsDo.ReplaceDB(db) return r } type roleActionsDo struct{ gen.DO } func (r roleActionsDo) Debug() *roleActionsDo { return r.withDO(r.DO.Debug()) } func (r roleActionsDo) WithContext(ctx context.Context) *roleActionsDo { return r.withDO(r.DO.WithContext(ctx)) } func (r roleActionsDo) ReadDB() *roleActionsDo { return r.Clauses(dbresolver.Read) } func (r roleActionsDo) WriteDB() *roleActionsDo { return r.Clauses(dbresolver.Write) } func (r roleActionsDo) Session(config *gorm.Session) *roleActionsDo { return r.withDO(r.DO.Session(config)) } func (r roleActionsDo) Clauses(conds ...clause.Expression) *roleActionsDo { return r.withDO(r.DO.Clauses(conds...)) } func (r roleActionsDo) Returning(value interface{}, columns ...string) *roleActionsDo { return r.withDO(r.DO.Returning(value, columns...)) } func (r roleActionsDo) Not(conds ...gen.Condition) *roleActionsDo { return r.withDO(r.DO.Not(conds...)) } func (r roleActionsDo) Or(conds ...gen.Condition) *roleActionsDo { return r.withDO(r.DO.Or(conds...)) } func (r roleActionsDo) Select(conds ...field.Expr) *roleActionsDo { return r.withDO(r.DO.Select(conds...)) } func (r roleActionsDo) Where(conds ...gen.Condition) *roleActionsDo { return r.withDO(r.DO.Where(conds...)) } func (r roleActionsDo) Order(conds ...field.Expr) *roleActionsDo { return r.withDO(r.DO.Order(conds...)) } func (r roleActionsDo) Distinct(cols ...field.Expr) *roleActionsDo { return r.withDO(r.DO.Distinct(cols...)) } func (r roleActionsDo) Omit(cols ...field.Expr) *roleActionsDo { return r.withDO(r.DO.Omit(cols...)) } func (r roleActionsDo) Join(table schema.Tabler, on ...field.Expr) *roleActionsDo { return r.withDO(r.DO.Join(table, on...)) } func (r roleActionsDo) LeftJoin(table schema.Tabler, on ...field.Expr) *roleActionsDo { return r.withDO(r.DO.LeftJoin(table, on...)) } func (r roleActionsDo) RightJoin(table schema.Tabler, on ...field.Expr) *roleActionsDo { return r.withDO(r.DO.RightJoin(table, on...)) } func (r roleActionsDo) Group(cols ...field.Expr) *roleActionsDo { return r.withDO(r.DO.Group(cols...)) } func (r roleActionsDo) Having(conds ...gen.Condition) *roleActionsDo { return r.withDO(r.DO.Having(conds...)) } func (r roleActionsDo) Limit(limit int) *roleActionsDo { return r.withDO(r.DO.Limit(limit)) } func (r roleActionsDo) Offset(offset int) *roleActionsDo { return r.withDO(r.DO.Offset(offset)) } func (r roleActionsDo) Scopes(funcs ...func(gen.Dao) gen.Dao) *roleActionsDo { return r.withDO(r.DO.Scopes(funcs...)) } func (r roleActionsDo) Unscoped() *roleActionsDo { return r.withDO(r.DO.Unscoped()) } func (r roleActionsDo) Create(values ...*model.RoleActions) error { if len(values) == 0 { return nil } return r.DO.Create(values) } func (r roleActionsDo) CreateInBatches(values []*model.RoleActions, batchSize int) error { return r.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 (r roleActionsDo) Save(values ...*model.RoleActions) error { if len(values) == 0 { return nil } return r.DO.Save(values) } func (r roleActionsDo) First() (*model.RoleActions, error) { if result, err := r.DO.First(); err != nil { return nil, err } else { return result.(*model.RoleActions), nil } } func (r roleActionsDo) Take() (*model.RoleActions, error) { if result, err := r.DO.Take(); err != nil { return nil, err } else { return result.(*model.RoleActions), nil } } func (r roleActionsDo) Last() (*model.RoleActions, error) { if result, err := r.DO.Last(); err != nil { return nil, err } else { return result.(*model.RoleActions), nil } } func (r roleActionsDo) Find() ([]*model.RoleActions, error) { result, err := r.DO.Find() return result.([]*model.RoleActions), err } func (r roleActionsDo) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*model.RoleActions, err error) { buf := make([]*model.RoleActions, 0, batchSize) err = r.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 (r roleActionsDo) FindInBatches(result *[]*model.RoleActions, batchSize int, fc func(tx gen.Dao, batch int) error) error { return r.DO.FindInBatches(result, batchSize, fc) } func (r roleActionsDo) Attrs(attrs ...field.AssignExpr) *roleActionsDo { return r.withDO(r.DO.Attrs(attrs...)) } func (r roleActionsDo) Assign(attrs ...field.AssignExpr) *roleActionsDo { return r.withDO(r.DO.Assign(attrs...)) } func (r roleActionsDo) Joins(fields ...field.RelationField) *roleActionsDo { for _, _f := range fields { r = *r.withDO(r.DO.Joins(_f)) } return &r } func (r roleActionsDo) Preload(fields ...field.RelationField) *roleActionsDo { for _, _f := range fields { r = *r.withDO(r.DO.Preload(_f)) } return &r } func (r roleActionsDo) FirstOrInit() (*model.RoleActions, error) { if result, err := r.DO.FirstOrInit(); err != nil { return nil, err } else { return result.(*model.RoleActions), nil } } func (r roleActionsDo) FirstOrCreate() (*model.RoleActions, error) { if result, err := r.DO.FirstOrCreate(); err != nil { return nil, err } else { return result.(*model.RoleActions), nil } } func (r roleActionsDo) FindByPage(offset int, limit int) (result []*model.RoleActions, count int64, err error) { result, err = r.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 = r.Offset(-1).Limit(-1).Count() return } func (r roleActionsDo) ScanByPage(result interface{}, offset int, limit int) (count int64, err error) { count, err = r.Count() if err != nil { return } err = r.Offset(offset).Limit(limit).Scan(result) return } func (r roleActionsDo) Scan(result interface{}) (err error) { return r.DO.Scan(result) } func (r roleActionsDo) Delete(models ...*model.RoleActions) (result gen.ResultInfo, err error) { return r.DO.Delete(models) } func (r *roleActionsDo) withDO(do gen.Dao) *roleActionsDo { r.DO = *do.(*gen.DO) return r }