// 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 dbgen import ( "context" "database/sql" "git.mstar.dev/mstar/linstrom/storage-new/models" "gorm.io/gorm" "gorm.io/gorm/clause" "gorm.io/gorm/schema" "gorm.io/gen" "gorm.io/gen/field" "gorm.io/plugin/dbresolver" ) func newFailedOutboundRequest(db *gorm.DB, opts ...gen.DOOption) failedOutboundRequest { _failedOutboundRequest := failedOutboundRequest{} _failedOutboundRequest.failedOutboundRequestDo.UseDB(db, opts...) _failedOutboundRequest.failedOutboundRequestDo.UseModel(&models.FailedOutboundRequest{}) tableName := _failedOutboundRequest.failedOutboundRequestDo.TableName() _failedOutboundRequest.ALL = field.NewAsterisk(tableName) _failedOutboundRequest.Id = field.NewUint64(tableName, "id") _failedOutboundRequest.RawData = field.NewBytes(tableName, "raw_data") _failedOutboundRequest.Target = field.NewString(tableName, "target") _failedOutboundRequest.FirstAttempt = field.NewTime(tableName, "first_attempt") _failedOutboundRequest.LastAttempt = field.NewTime(tableName, "last_attempt") _failedOutboundRequest.ActingUserId = field.NewString(tableName, "acting_user_id") _failedOutboundRequest.NrOfAttempts = field.NewUint32(tableName, "nr_of_attempts") _failedOutboundRequest.LastFailureReason = field.NewString(tableName, "last_failure_reason") _failedOutboundRequest.TargetServerId = field.NewUint(tableName, "target_server_id") _failedOutboundRequest.ActingUser = failedOutboundRequestBelongsToActingUser{ db: db.Session(&gorm.Session{}), RelationField: field.NewRelation("ActingUser", "models.User"), Server: struct { field.RelationField Icon struct { field.RelationField } Metadata struct { field.RelationField RemoteServer struct { field.RelationField } } }{ RelationField: field.NewRelation("ActingUser.Server", "models.RemoteServer"), Icon: struct { field.RelationField }{ RelationField: field.NewRelation("ActingUser.Server.Icon", "models.MediaMetadata"), }, Metadata: struct { field.RelationField RemoteServer struct { field.RelationField } }{ RelationField: field.NewRelation("ActingUser.Server.Metadata", "models.RemoteServerMetadata"), RemoteServer: struct { field.RelationField }{ RelationField: field.NewRelation("ActingUser.Server.Metadata.RemoteServer", "models.RemoteServer"), }, }, }, Icon: struct { field.RelationField }{ RelationField: field.NewRelation("ActingUser.Icon", "models.MediaMetadata"), }, Background: struct { field.RelationField }{ RelationField: field.NewRelation("ActingUser.Background", "models.MediaMetadata"), }, Banner: struct { field.RelationField }{ RelationField: field.NewRelation("ActingUser.Banner", "models.MediaMetadata"), }, RemoteInfo: struct { field.RelationField User struct { field.RelationField } }{ RelationField: field.NewRelation("ActingUser.RemoteInfo", "models.UserRemoteLinks"), User: struct { field.RelationField }{ RelationField: field.NewRelation("ActingUser.RemoteInfo.User", "models.User"), }, }, InfoFields: struct { field.RelationField User struct { field.RelationField } }{ RelationField: field.NewRelation("ActingUser.InfoFields", "models.UserInfoField"), User: struct { field.RelationField }{ RelationField: field.NewRelation("ActingUser.InfoFields.User", "models.User"), }, }, BeingTypes: struct { field.RelationField User struct { field.RelationField } }{ RelationField: field.NewRelation("ActingUser.BeingTypes", "models.UserToBeing"), User: struct { field.RelationField }{ RelationField: field.NewRelation("ActingUser.BeingTypes.User", "models.User"), }, }, Tags: struct { field.RelationField User struct { field.RelationField } }{ RelationField: field.NewRelation("ActingUser.Tags", "models.UserToTag"), User: struct { field.RelationField }{ RelationField: field.NewRelation("ActingUser.Tags.User", "models.User"), }, }, Relations: struct { field.RelationField User struct { field.RelationField } TargetUser struct { field.RelationField } }{ RelationField: field.NewRelation("ActingUser.Relations", "models.UserToUserRelation"), User: struct { field.RelationField }{ RelationField: field.NewRelation("ActingUser.Relations.User", "models.User"), }, TargetUser: struct { field.RelationField }{ RelationField: field.NewRelation("ActingUser.Relations.TargetUser", "models.User"), }, }, Pronouns: struct { field.RelationField User struct { field.RelationField } }{ RelationField: field.NewRelation("ActingUser.Pronouns", "models.UserToPronoun"), User: struct { field.RelationField }{ RelationField: field.NewRelation("ActingUser.Pronouns.User", "models.User"), }, }, Roles: struct { field.RelationField User struct { field.RelationField } Role struct { field.RelationField } }{ RelationField: field.NewRelation("ActingUser.Roles", "models.UserToRole"), User: struct { field.RelationField }{ RelationField: field.NewRelation("ActingUser.Roles.User", "models.User"), }, Role: struct { field.RelationField }{ RelationField: field.NewRelation("ActingUser.Roles.Role", "models.Role"), }, }, AuthMethods: struct { field.RelationField User struct { field.RelationField } }{ RelationField: field.NewRelation("ActingUser.AuthMethods", "models.UserAuthMethod"), User: struct { field.RelationField }{ RelationField: field.NewRelation("ActingUser.AuthMethods.User", "models.User"), }, }, } _failedOutboundRequest.TargetServer = failedOutboundRequestBelongsToTargetServer{ db: db.Session(&gorm.Session{}), RelationField: field.NewRelation("TargetServer", "models.RemoteServer"), } _failedOutboundRequest.fillFieldMap() return _failedOutboundRequest } type failedOutboundRequest struct { failedOutboundRequestDo ALL field.Asterisk Id field.Uint64 RawData field.Bytes Target field.String FirstAttempt field.Time LastAttempt field.Time ActingUserId field.String NrOfAttempts field.Uint32 LastFailureReason field.String TargetServerId field.Uint ActingUser failedOutboundRequestBelongsToActingUser TargetServer failedOutboundRequestBelongsToTargetServer fieldMap map[string]field.Expr } func (f failedOutboundRequest) Table(newTableName string) *failedOutboundRequest { f.failedOutboundRequestDo.UseTable(newTableName) return f.updateTableName(newTableName) } func (f failedOutboundRequest) As(alias string) *failedOutboundRequest { f.failedOutboundRequestDo.DO = *(f.failedOutboundRequestDo.As(alias).(*gen.DO)) return f.updateTableName(alias) } func (f *failedOutboundRequest) updateTableName(table string) *failedOutboundRequest { f.ALL = field.NewAsterisk(table) f.Id = field.NewUint64(table, "id") f.RawData = field.NewBytes(table, "raw_data") f.Target = field.NewString(table, "target") f.FirstAttempt = field.NewTime(table, "first_attempt") f.LastAttempt = field.NewTime(table, "last_attempt") f.ActingUserId = field.NewString(table, "acting_user_id") f.NrOfAttempts = field.NewUint32(table, "nr_of_attempts") f.LastFailureReason = field.NewString(table, "last_failure_reason") f.TargetServerId = field.NewUint(table, "target_server_id") f.fillFieldMap() return f } func (f *failedOutboundRequest) GetFieldByName(fieldName string) (field.OrderExpr, bool) { _f, ok := f.fieldMap[fieldName] if !ok || _f == nil { return nil, false } _oe, ok := _f.(field.OrderExpr) return _oe, ok } func (f *failedOutboundRequest) fillFieldMap() { f.fieldMap = make(map[string]field.Expr, 11) f.fieldMap["id"] = f.Id f.fieldMap["raw_data"] = f.RawData f.fieldMap["target"] = f.Target f.fieldMap["first_attempt"] = f.FirstAttempt f.fieldMap["last_attempt"] = f.LastAttempt f.fieldMap["acting_user_id"] = f.ActingUserId f.fieldMap["nr_of_attempts"] = f.NrOfAttempts f.fieldMap["last_failure_reason"] = f.LastFailureReason f.fieldMap["target_server_id"] = f.TargetServerId } func (f failedOutboundRequest) clone(db *gorm.DB) failedOutboundRequest { f.failedOutboundRequestDo.ReplaceConnPool(db.Statement.ConnPool) f.ActingUser.db = db.Session(&gorm.Session{Initialized: true}) f.ActingUser.db.Statement.ConnPool = db.Statement.ConnPool f.TargetServer.db = db.Session(&gorm.Session{Initialized: true}) f.TargetServer.db.Statement.ConnPool = db.Statement.ConnPool return f } func (f failedOutboundRequest) replaceDB(db *gorm.DB) failedOutboundRequest { f.failedOutboundRequestDo.ReplaceDB(db) f.ActingUser.db = db.Session(&gorm.Session{}) f.TargetServer.db = db.Session(&gorm.Session{}) return f } type failedOutboundRequestBelongsToActingUser struct { db *gorm.DB field.RelationField Server struct { field.RelationField Icon struct { field.RelationField } Metadata struct { field.RelationField RemoteServer struct { field.RelationField } } } Icon struct { field.RelationField } Background struct { field.RelationField } Banner struct { field.RelationField } RemoteInfo struct { field.RelationField User struct { field.RelationField } } InfoFields struct { field.RelationField User struct { field.RelationField } } BeingTypes struct { field.RelationField User struct { field.RelationField } } Tags struct { field.RelationField User struct { field.RelationField } } Relations struct { field.RelationField User struct { field.RelationField } TargetUser struct { field.RelationField } } Pronouns struct { field.RelationField User struct { field.RelationField } } Roles struct { field.RelationField User struct { field.RelationField } Role struct { field.RelationField } } AuthMethods struct { field.RelationField User struct { field.RelationField } } } func (a failedOutboundRequestBelongsToActingUser) Where(conds ...field.Expr) *failedOutboundRequestBelongsToActingUser { if len(conds) == 0 { return &a } exprs := make([]clause.Expression, 0, len(conds)) for _, cond := range conds { exprs = append(exprs, cond.BeCond().(clause.Expression)) } a.db = a.db.Clauses(clause.Where{Exprs: exprs}) return &a } func (a failedOutboundRequestBelongsToActingUser) WithContext(ctx context.Context) *failedOutboundRequestBelongsToActingUser { a.db = a.db.WithContext(ctx) return &a } func (a failedOutboundRequestBelongsToActingUser) Session(session *gorm.Session) *failedOutboundRequestBelongsToActingUser { a.db = a.db.Session(session) return &a } func (a failedOutboundRequestBelongsToActingUser) Model(m *models.FailedOutboundRequest) *failedOutboundRequestBelongsToActingUserTx { return &failedOutboundRequestBelongsToActingUserTx{a.db.Model(m).Association(a.Name())} } func (a failedOutboundRequestBelongsToActingUser) Unscoped() *failedOutboundRequestBelongsToActingUser { a.db = a.db.Unscoped() return &a } type failedOutboundRequestBelongsToActingUserTx struct{ tx *gorm.Association } func (a failedOutboundRequestBelongsToActingUserTx) Find() (result *models.User, err error) { return result, a.tx.Find(&result) } func (a failedOutboundRequestBelongsToActingUserTx) Append(values ...*models.User) (err error) { targetValues := make([]interface{}, len(values)) for i, v := range values { targetValues[i] = v } return a.tx.Append(targetValues...) } func (a failedOutboundRequestBelongsToActingUserTx) Replace(values ...*models.User) (err error) { targetValues := make([]interface{}, len(values)) for i, v := range values { targetValues[i] = v } return a.tx.Replace(targetValues...) } func (a failedOutboundRequestBelongsToActingUserTx) Delete(values ...*models.User) (err error) { targetValues := make([]interface{}, len(values)) for i, v := range values { targetValues[i] = v } return a.tx.Delete(targetValues...) } func (a failedOutboundRequestBelongsToActingUserTx) Clear() error { return a.tx.Clear() } func (a failedOutboundRequestBelongsToActingUserTx) Count() int64 { return a.tx.Count() } func (a failedOutboundRequestBelongsToActingUserTx) Unscoped() *failedOutboundRequestBelongsToActingUserTx { a.tx = a.tx.Unscoped() return &a } type failedOutboundRequestBelongsToTargetServer struct { db *gorm.DB field.RelationField } func (a failedOutboundRequestBelongsToTargetServer) Where(conds ...field.Expr) *failedOutboundRequestBelongsToTargetServer { if len(conds) == 0 { return &a } exprs := make([]clause.Expression, 0, len(conds)) for _, cond := range conds { exprs = append(exprs, cond.BeCond().(clause.Expression)) } a.db = a.db.Clauses(clause.Where{Exprs: exprs}) return &a } func (a failedOutboundRequestBelongsToTargetServer) WithContext(ctx context.Context) *failedOutboundRequestBelongsToTargetServer { a.db = a.db.WithContext(ctx) return &a } func (a failedOutboundRequestBelongsToTargetServer) Session(session *gorm.Session) *failedOutboundRequestBelongsToTargetServer { a.db = a.db.Session(session) return &a } func (a failedOutboundRequestBelongsToTargetServer) Model(m *models.FailedOutboundRequest) *failedOutboundRequestBelongsToTargetServerTx { return &failedOutboundRequestBelongsToTargetServerTx{a.db.Model(m).Association(a.Name())} } func (a failedOutboundRequestBelongsToTargetServer) Unscoped() *failedOutboundRequestBelongsToTargetServer { a.db = a.db.Unscoped() return &a } type failedOutboundRequestBelongsToTargetServerTx struct{ tx *gorm.Association } func (a failedOutboundRequestBelongsToTargetServerTx) Find() (result *models.RemoteServer, err error) { return result, a.tx.Find(&result) } func (a failedOutboundRequestBelongsToTargetServerTx) Append(values ...*models.RemoteServer) (err error) { targetValues := make([]interface{}, len(values)) for i, v := range values { targetValues[i] = v } return a.tx.Append(targetValues...) } func (a failedOutboundRequestBelongsToTargetServerTx) Replace(values ...*models.RemoteServer) (err error) { targetValues := make([]interface{}, len(values)) for i, v := range values { targetValues[i] = v } return a.tx.Replace(targetValues...) } func (a failedOutboundRequestBelongsToTargetServerTx) Delete(values ...*models.RemoteServer) (err error) { targetValues := make([]interface{}, len(values)) for i, v := range values { targetValues[i] = v } return a.tx.Delete(targetValues...) } func (a failedOutboundRequestBelongsToTargetServerTx) Clear() error { return a.tx.Clear() } func (a failedOutboundRequestBelongsToTargetServerTx) Count() int64 { return a.tx.Count() } func (a failedOutboundRequestBelongsToTargetServerTx) Unscoped() *failedOutboundRequestBelongsToTargetServerTx { a.tx = a.tx.Unscoped() return &a } type failedOutboundRequestDo struct{ gen.DO } type IFailedOutboundRequestDo interface { gen.SubQuery Debug() IFailedOutboundRequestDo WithContext(ctx context.Context) IFailedOutboundRequestDo WithResult(fc func(tx gen.Dao)) gen.ResultInfo ReplaceDB(db *gorm.DB) ReadDB() IFailedOutboundRequestDo WriteDB() IFailedOutboundRequestDo As(alias string) gen.Dao Session(config *gorm.Session) IFailedOutboundRequestDo Columns(cols ...field.Expr) gen.Columns Clauses(conds ...clause.Expression) IFailedOutboundRequestDo Not(conds ...gen.Condition) IFailedOutboundRequestDo Or(conds ...gen.Condition) IFailedOutboundRequestDo Select(conds ...field.Expr) IFailedOutboundRequestDo Where(conds ...gen.Condition) IFailedOutboundRequestDo Order(conds ...field.Expr) IFailedOutboundRequestDo Distinct(cols ...field.Expr) IFailedOutboundRequestDo Omit(cols ...field.Expr) IFailedOutboundRequestDo Join(table schema.Tabler, on ...field.Expr) IFailedOutboundRequestDo LeftJoin(table schema.Tabler, on ...field.Expr) IFailedOutboundRequestDo RightJoin(table schema.Tabler, on ...field.Expr) IFailedOutboundRequestDo Group(cols ...field.Expr) IFailedOutboundRequestDo Having(conds ...gen.Condition) IFailedOutboundRequestDo Limit(limit int) IFailedOutboundRequestDo Offset(offset int) IFailedOutboundRequestDo Count() (count int64, err error) Scopes(funcs ...func(gen.Dao) gen.Dao) IFailedOutboundRequestDo Unscoped() IFailedOutboundRequestDo Create(values ...*models.FailedOutboundRequest) error CreateInBatches(values []*models.FailedOutboundRequest, batchSize int) error Save(values ...*models.FailedOutboundRequest) error First() (*models.FailedOutboundRequest, error) Take() (*models.FailedOutboundRequest, error) Last() (*models.FailedOutboundRequest, error) Find() ([]*models.FailedOutboundRequest, error) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*models.FailedOutboundRequest, err error) FindInBatches(result *[]*models.FailedOutboundRequest, batchSize int, fc func(tx gen.Dao, batch int) error) error Pluck(column field.Expr, dest interface{}) error Delete(...*models.FailedOutboundRequest) (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) IFailedOutboundRequestDo Assign(attrs ...field.AssignExpr) IFailedOutboundRequestDo Joins(fields ...field.RelationField) IFailedOutboundRequestDo Preload(fields ...field.RelationField) IFailedOutboundRequestDo FirstOrInit() (*models.FailedOutboundRequest, error) FirstOrCreate() (*models.FailedOutboundRequest, error) FindByPage(offset int, limit int) (result []*models.FailedOutboundRequest, count int64, err error) ScanByPage(result interface{}, offset int, limit int) (count int64, err error) Rows() (*sql.Rows, error) Row() *sql.Row Scan(result interface{}) (err error) Returning(value interface{}, columns ...string) IFailedOutboundRequestDo UnderlyingDB() *gorm.DB schema.Tabler } func (f failedOutboundRequestDo) Debug() IFailedOutboundRequestDo { return f.withDO(f.DO.Debug()) } func (f failedOutboundRequestDo) WithContext(ctx context.Context) IFailedOutboundRequestDo { return f.withDO(f.DO.WithContext(ctx)) } func (f failedOutboundRequestDo) ReadDB() IFailedOutboundRequestDo { return f.Clauses(dbresolver.Read) } func (f failedOutboundRequestDo) WriteDB() IFailedOutboundRequestDo { return f.Clauses(dbresolver.Write) } func (f failedOutboundRequestDo) Session(config *gorm.Session) IFailedOutboundRequestDo { return f.withDO(f.DO.Session(config)) } func (f failedOutboundRequestDo) Clauses(conds ...clause.Expression) IFailedOutboundRequestDo { return f.withDO(f.DO.Clauses(conds...)) } func (f failedOutboundRequestDo) Returning(value interface{}, columns ...string) IFailedOutboundRequestDo { return f.withDO(f.DO.Returning(value, columns...)) } func (f failedOutboundRequestDo) Not(conds ...gen.Condition) IFailedOutboundRequestDo { return f.withDO(f.DO.Not(conds...)) } func (f failedOutboundRequestDo) Or(conds ...gen.Condition) IFailedOutboundRequestDo { return f.withDO(f.DO.Or(conds...)) } func (f failedOutboundRequestDo) Select(conds ...field.Expr) IFailedOutboundRequestDo { return f.withDO(f.DO.Select(conds...)) } func (f failedOutboundRequestDo) Where(conds ...gen.Condition) IFailedOutboundRequestDo { return f.withDO(f.DO.Where(conds...)) } func (f failedOutboundRequestDo) Order(conds ...field.Expr) IFailedOutboundRequestDo { return f.withDO(f.DO.Order(conds...)) } func (f failedOutboundRequestDo) Distinct(cols ...field.Expr) IFailedOutboundRequestDo { return f.withDO(f.DO.Distinct(cols...)) } func (f failedOutboundRequestDo) Omit(cols ...field.Expr) IFailedOutboundRequestDo { return f.withDO(f.DO.Omit(cols...)) } func (f failedOutboundRequestDo) Join(table schema.Tabler, on ...field.Expr) IFailedOutboundRequestDo { return f.withDO(f.DO.Join(table, on...)) } func (f failedOutboundRequestDo) LeftJoin(table schema.Tabler, on ...field.Expr) IFailedOutboundRequestDo { return f.withDO(f.DO.LeftJoin(table, on...)) } func (f failedOutboundRequestDo) RightJoin(table schema.Tabler, on ...field.Expr) IFailedOutboundRequestDo { return f.withDO(f.DO.RightJoin(table, on...)) } func (f failedOutboundRequestDo) Group(cols ...field.Expr) IFailedOutboundRequestDo { return f.withDO(f.DO.Group(cols...)) } func (f failedOutboundRequestDo) Having(conds ...gen.Condition) IFailedOutboundRequestDo { return f.withDO(f.DO.Having(conds...)) } func (f failedOutboundRequestDo) Limit(limit int) IFailedOutboundRequestDo { return f.withDO(f.DO.Limit(limit)) } func (f failedOutboundRequestDo) Offset(offset int) IFailedOutboundRequestDo { return f.withDO(f.DO.Offset(offset)) } func (f failedOutboundRequestDo) Scopes(funcs ...func(gen.Dao) gen.Dao) IFailedOutboundRequestDo { return f.withDO(f.DO.Scopes(funcs...)) } func (f failedOutboundRequestDo) Unscoped() IFailedOutboundRequestDo { return f.withDO(f.DO.Unscoped()) } func (f failedOutboundRequestDo) Create(values ...*models.FailedOutboundRequest) error { if len(values) == 0 { return nil } return f.DO.Create(values) } func (f failedOutboundRequestDo) CreateInBatches(values []*models.FailedOutboundRequest, batchSize int) error { return f.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 (f failedOutboundRequestDo) Save(values ...*models.FailedOutboundRequest) error { if len(values) == 0 { return nil } return f.DO.Save(values) } func (f failedOutboundRequestDo) First() (*models.FailedOutboundRequest, error) { if result, err := f.DO.First(); err != nil { return nil, err } else { return result.(*models.FailedOutboundRequest), nil } } func (f failedOutboundRequestDo) Take() (*models.FailedOutboundRequest, error) { if result, err := f.DO.Take(); err != nil { return nil, err } else { return result.(*models.FailedOutboundRequest), nil } } func (f failedOutboundRequestDo) Last() (*models.FailedOutboundRequest, error) { if result, err := f.DO.Last(); err != nil { return nil, err } else { return result.(*models.FailedOutboundRequest), nil } } func (f failedOutboundRequestDo) Find() ([]*models.FailedOutboundRequest, error) { result, err := f.DO.Find() return result.([]*models.FailedOutboundRequest), err } func (f failedOutboundRequestDo) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*models.FailedOutboundRequest, err error) { buf := make([]*models.FailedOutboundRequest, 0, batchSize) err = f.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 (f failedOutboundRequestDo) FindInBatches(result *[]*models.FailedOutboundRequest, batchSize int, fc func(tx gen.Dao, batch int) error) error { return f.DO.FindInBatches(result, batchSize, fc) } func (f failedOutboundRequestDo) Attrs(attrs ...field.AssignExpr) IFailedOutboundRequestDo { return f.withDO(f.DO.Attrs(attrs...)) } func (f failedOutboundRequestDo) Assign(attrs ...field.AssignExpr) IFailedOutboundRequestDo { return f.withDO(f.DO.Assign(attrs...)) } func (f failedOutboundRequestDo) Joins(fields ...field.RelationField) IFailedOutboundRequestDo { for _, _f := range fields { f = *f.withDO(f.DO.Joins(_f)) } return &f } func (f failedOutboundRequestDo) Preload(fields ...field.RelationField) IFailedOutboundRequestDo { for _, _f := range fields { f = *f.withDO(f.DO.Preload(_f)) } return &f } func (f failedOutboundRequestDo) FirstOrInit() (*models.FailedOutboundRequest, error) { if result, err := f.DO.FirstOrInit(); err != nil { return nil, err } else { return result.(*models.FailedOutboundRequest), nil } } func (f failedOutboundRequestDo) FirstOrCreate() (*models.FailedOutboundRequest, error) { if result, err := f.DO.FirstOrCreate(); err != nil { return nil, err } else { return result.(*models.FailedOutboundRequest), nil } } func (f failedOutboundRequestDo) FindByPage(offset int, limit int) (result []*models.FailedOutboundRequest, count int64, err error) { result, err = f.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 = f.Offset(-1).Limit(-1).Count() return } func (f failedOutboundRequestDo) ScanByPage(result interface{}, offset int, limit int) (count int64, err error) { count, err = f.Count() if err != nil { return } err = f.Offset(offset).Limit(limit).Scan(result) return } func (f failedOutboundRequestDo) Scan(result interface{}) (err error) { return f.DO.Scan(result) } func (f failedOutboundRequestDo) Delete(models ...*models.FailedOutboundRequest) (result gen.ResultInfo, err error) { return f.DO.Delete(models) } func (f *failedOutboundRequestDo) withDO(do gen.Dao) *failedOutboundRequestDo { f.DO = *do.(*gen.DO) return f }