// 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 model import ( "context" "gorm.io/gorm" "gorm.io/gorm/clause" "gorm.io/gorm/schema" "gorm.io/gen" "gorm.io/gen/field" "gorm.io/plugin/dbresolver" "icloudapp.cn/tools/service/entity" ) func newUserPosterBatch(db *gorm.DB, opts ...gen.DOOption) MUserPosterBatch { _MUserPosterBatch := MUserPosterBatch{} _MUserPosterBatch.MUserPosterBatchDo.UseDB(db, opts...) _MUserPosterBatch.MUserPosterBatchDo.UseModel(&entity.UserPosterBatch{}) tableName := _MUserPosterBatch.MUserPosterBatchDo.TableName() _MUserPosterBatch.ALL = field.NewAsterisk(tableName) _MUserPosterBatch.BatchID = field.NewInt64(tableName, "batch_id") _MUserPosterBatch.UID = field.NewInt64(tableName, "uid") _MUserPosterBatch.PosterID = field.NewInt64(tableName, "poster_id") _MUserPosterBatch.Name = field.NewString(tableName, "name") _MUserPosterBatch.UUID = field.NewString(tableName, "uuid") _MUserPosterBatch.Raw = field.NewString(tableName, "raw") _MUserPosterBatch.Num = field.NewInt64(tableName, "num") _MUserPosterBatch.DoneNum = field.NewInt64(tableName, "done_num") _MUserPosterBatch.Type = field.NewString(tableName, "type") _MUserPosterBatch.Path = field.NewString(tableName, "path") _MUserPosterBatch.Status = field.NewInt64(tableName, "status") _MUserPosterBatch.CreateAt = field.NewTime(tableName, "create_at") _MUserPosterBatch.UpdateAt = field.NewTime(tableName, "update_at") _MUserPosterBatch.fillFieldMap() return _MUserPosterBatch } type MUserPosterBatch struct { MUserPosterBatchDo MUserPosterBatchDo ALL field.Asterisk BatchID field.Int64 UID field.Int64 // 用户ID PosterID field.Int64 // 海报ID Name field.String // 海报名称 UUID field.String // 海报唯一标识 Raw field.String // 生成的内容 Num field.Int64 // 海报份数 DoneNum field.Int64 // 已经生成的份数 Type field.String // 生成图片类型 Path field.String // 海报存储路径 Status field.Int64 // 海报生成状态 CreateAt field.Time // 创建时间 UpdateAt field.Time // 更新时间 fieldMap map[string]field.Expr } func (u MUserPosterBatch) Table(newTableName string) *MUserPosterBatch { u.MUserPosterBatchDo.UseTable(newTableName) return u.updateTableName(newTableName) } func (u MUserPosterBatch) As(alias string) *MUserPosterBatch { u.MUserPosterBatchDo.DO = *(u.MUserPosterBatchDo.As(alias).(*gen.DO)) return u.updateTableName(alias) } func (u *MUserPosterBatch) updateTableName(table string) *MUserPosterBatch { u.ALL = field.NewAsterisk(table) u.BatchID = field.NewInt64(table, "batch_id") u.UID = field.NewInt64(table, "uid") u.PosterID = field.NewInt64(table, "poster_id") u.Name = field.NewString(table, "name") u.UUID = field.NewString(table, "uuid") u.Raw = field.NewString(table, "raw") u.Num = field.NewInt64(table, "num") u.DoneNum = field.NewInt64(table, "done_num") u.Type = field.NewString(table, "type") u.Path = field.NewString(table, "path") u.Status = field.NewInt64(table, "status") u.CreateAt = field.NewTime(table, "create_at") u.UpdateAt = field.NewTime(table, "update_at") u.fillFieldMap() return u } func (u *MUserPosterBatch) WithContext(ctx context.Context) IUserPosterBatchDo { return u.MUserPosterBatchDo.WithContext(ctx) } func (u MUserPosterBatch) TableName() string { return u.MUserPosterBatchDo.TableName() } func (u MUserPosterBatch) Alias() string { return u.MUserPosterBatchDo.Alias() } func (u *MUserPosterBatch) GetFieldByName(fieldName string) (field.OrderExpr, bool) { _f, ok := u.fieldMap[fieldName] if !ok || _f == nil { return nil, false } _oe, ok := _f.(field.OrderExpr) return _oe, ok } func (u *MUserPosterBatch) fillFieldMap() { u.fieldMap = make(map[string]field.Expr, 13) u.fieldMap["batch_id"] = u.BatchID u.fieldMap["uid"] = u.UID u.fieldMap["poster_id"] = u.PosterID u.fieldMap["name"] = u.Name u.fieldMap["uuid"] = u.UUID u.fieldMap["raw"] = u.Raw u.fieldMap["num"] = u.Num u.fieldMap["done_num"] = u.DoneNum u.fieldMap["type"] = u.Type u.fieldMap["path"] = u.Path u.fieldMap["status"] = u.Status u.fieldMap["create_at"] = u.CreateAt u.fieldMap["update_at"] = u.UpdateAt } func (u MUserPosterBatch) clone(db *gorm.DB) MUserPosterBatch { u.MUserPosterBatchDo.ReplaceConnPool(db.Statement.ConnPool) return u } func (u MUserPosterBatch) replaceDB(db *gorm.DB) MUserPosterBatch { u.MUserPosterBatchDo.ReplaceDB(db) return u } type MUserPosterBatchDo struct{ gen.DO } type IUserPosterBatchDo interface { gen.SubQuery Debug() IUserPosterBatchDo WithContext(ctx context.Context) IUserPosterBatchDo WithResult(fc func(tx gen.Dao)) gen.ResultInfo ReplaceDB(db *gorm.DB) ReadDB() IUserPosterBatchDo WriteDB() IUserPosterBatchDo As(alias string) gen.Dao Session(config *gorm.Session) IUserPosterBatchDo Columns(cols ...field.Expr) gen.Columns Clauses(conds ...clause.Expression) IUserPosterBatchDo Not(conds ...gen.Condition) IUserPosterBatchDo Or(conds ...gen.Condition) IUserPosterBatchDo Select(conds ...field.Expr) IUserPosterBatchDo Where(conds ...gen.Condition) IUserPosterBatchDo Order(conds ...field.Expr) IUserPosterBatchDo Distinct(cols ...field.Expr) IUserPosterBatchDo Omit(cols ...field.Expr) IUserPosterBatchDo Join(table schema.Tabler, on ...field.Expr) IUserPosterBatchDo LeftJoin(table schema.Tabler, on ...field.Expr) IUserPosterBatchDo RightJoin(table schema.Tabler, on ...field.Expr) IUserPosterBatchDo Group(cols ...field.Expr) IUserPosterBatchDo Having(conds ...gen.Condition) IUserPosterBatchDo Limit(limit int) IUserPosterBatchDo Offset(offset int) IUserPosterBatchDo Count() (count int64, err error) Scopes(funcs ...func(gen.Dao) gen.Dao) IUserPosterBatchDo Unscoped() IUserPosterBatchDo Create(values ...*entity.UserPosterBatch) error CreateInBatches(values []*entity.UserPosterBatch, batchSize int) error Save(values ...*entity.UserPosterBatch) error First() (*entity.UserPosterBatch, error) Take() (*entity.UserPosterBatch, error) Last() (*entity.UserPosterBatch, error) Find() ([]*entity.UserPosterBatch, error) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*entity.UserPosterBatch, err error) FindInBatches(result *[]*entity.UserPosterBatch, batchSize int, fc func(tx gen.Dao, batch int) error) error Pluck(column field.Expr, dest interface{}) error Delete(...*entity.UserPosterBatch) (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) IUserPosterBatchDo Assign(attrs ...field.AssignExpr) IUserPosterBatchDo Joins(fields ...field.RelationField) IUserPosterBatchDo Preload(fields ...field.RelationField) IUserPosterBatchDo FirstOrInit() (*entity.UserPosterBatch, error) FirstOrCreate() (*entity.UserPosterBatch, error) FindByPage(offset int, limit int) (result []*entity.UserPosterBatch, count int64, err error) ScanByPage(result interface{}, offset int, limit int) (count int64, err error) Scan(result interface{}) (err error) Returning(value interface{}, columns ...string) IUserPosterBatchDo UnderlyingDB() *gorm.DB schema.Tabler } func (u MUserPosterBatchDo) Debug() IUserPosterBatchDo { return u.withDO(u.DO.Debug()) } func (u MUserPosterBatchDo) WithContext(ctx context.Context) IUserPosterBatchDo { return u.withDO(u.DO.WithContext(ctx)) } func (u MUserPosterBatchDo) ReadDB() IUserPosterBatchDo { return u.Clauses(dbresolver.Read) } func (u MUserPosterBatchDo) WriteDB() IUserPosterBatchDo { return u.Clauses(dbresolver.Write) } func (u MUserPosterBatchDo) Session(config *gorm.Session) IUserPosterBatchDo { return u.withDO(u.DO.Session(config)) } func (u MUserPosterBatchDo) Clauses(conds ...clause.Expression) IUserPosterBatchDo { return u.withDO(u.DO.Clauses(conds...)) } func (u MUserPosterBatchDo) Returning(value interface{}, columns ...string) IUserPosterBatchDo { return u.withDO(u.DO.Returning(value, columns...)) } func (u MUserPosterBatchDo) Not(conds ...gen.Condition) IUserPosterBatchDo { return u.withDO(u.DO.Not(conds...)) } func (u MUserPosterBatchDo) Or(conds ...gen.Condition) IUserPosterBatchDo { return u.withDO(u.DO.Or(conds...)) } func (u MUserPosterBatchDo) Select(conds ...field.Expr) IUserPosterBatchDo { return u.withDO(u.DO.Select(conds...)) } func (u MUserPosterBatchDo) Where(conds ...gen.Condition) IUserPosterBatchDo { return u.withDO(u.DO.Where(conds...)) } func (u MUserPosterBatchDo) Exists(subquery interface{ UnderlyingDB() *gorm.DB }) IUserPosterBatchDo { return u.Where(field.CompareSubQuery(field.ExistsOp, nil, subquery.UnderlyingDB())) } func (u MUserPosterBatchDo) Order(conds ...field.Expr) IUserPosterBatchDo { return u.withDO(u.DO.Order(conds...)) } func (u MUserPosterBatchDo) Distinct(cols ...field.Expr) IUserPosterBatchDo { return u.withDO(u.DO.Distinct(cols...)) } func (u MUserPosterBatchDo) Omit(cols ...field.Expr) IUserPosterBatchDo { return u.withDO(u.DO.Omit(cols...)) } func (u MUserPosterBatchDo) Join(table schema.Tabler, on ...field.Expr) IUserPosterBatchDo { return u.withDO(u.DO.Join(table, on...)) } func (u MUserPosterBatchDo) LeftJoin(table schema.Tabler, on ...field.Expr) IUserPosterBatchDo { return u.withDO(u.DO.LeftJoin(table, on...)) } func (u MUserPosterBatchDo) RightJoin(table schema.Tabler, on ...field.Expr) IUserPosterBatchDo { return u.withDO(u.DO.RightJoin(table, on...)) } func (u MUserPosterBatchDo) Group(cols ...field.Expr) IUserPosterBatchDo { return u.withDO(u.DO.Group(cols...)) } func (u MUserPosterBatchDo) Having(conds ...gen.Condition) IUserPosterBatchDo { return u.withDO(u.DO.Having(conds...)) } func (u MUserPosterBatchDo) Limit(limit int) IUserPosterBatchDo { return u.withDO(u.DO.Limit(limit)) } func (u MUserPosterBatchDo) Offset(offset int) IUserPosterBatchDo { return u.withDO(u.DO.Offset(offset)) } func (u MUserPosterBatchDo) Scopes(funcs ...func(gen.Dao) gen.Dao) IUserPosterBatchDo { return u.withDO(u.DO.Scopes(funcs...)) } func (u MUserPosterBatchDo) Unscoped() IUserPosterBatchDo { return u.withDO(u.DO.Unscoped()) } func (u MUserPosterBatchDo) Create(values ...*entity.UserPosterBatch) error { if len(values) == 0 { return nil } return u.DO.Create(values) } func (u MUserPosterBatchDo) CreateInBatches(values []*entity.UserPosterBatch, batchSize int) error { return u.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 (u MUserPosterBatchDo) Save(values ...*entity.UserPosterBatch) error { if len(values) == 0 { return nil } return u.DO.Save(values) } func (u MUserPosterBatchDo) First() (*entity.UserPosterBatch, error) { if result, err := u.DO.First(); err != nil { return nil, err } else { return result.(*entity.UserPosterBatch), nil } } func (u MUserPosterBatchDo) Take() (*entity.UserPosterBatch, error) { if result, err := u.DO.Take(); err != nil { return nil, err } else { return result.(*entity.UserPosterBatch), nil } } func (u MUserPosterBatchDo) Last() (*entity.UserPosterBatch, error) { if result, err := u.DO.Last(); err != nil { return nil, err } else { return result.(*entity.UserPosterBatch), nil } } func (u MUserPosterBatchDo) Find() ([]*entity.UserPosterBatch, error) { result, err := u.DO.Find() return result.([]*entity.UserPosterBatch), err } func (u MUserPosterBatchDo) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*entity.UserPosterBatch, err error) { buf := make([]*entity.UserPosterBatch, 0, batchSize) err = u.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 (u MUserPosterBatchDo) FindInBatches(result *[]*entity.UserPosterBatch, batchSize int, fc func(tx gen.Dao, batch int) error) error { return u.DO.FindInBatches(result, batchSize, fc) } func (u MUserPosterBatchDo) Attrs(attrs ...field.AssignExpr) IUserPosterBatchDo { return u.withDO(u.DO.Attrs(attrs...)) } func (u MUserPosterBatchDo) Assign(attrs ...field.AssignExpr) IUserPosterBatchDo { return u.withDO(u.DO.Assign(attrs...)) } func (u MUserPosterBatchDo) Joins(fields ...field.RelationField) IUserPosterBatchDo { for _, _f := range fields { u = *u.withDO(u.DO.Joins(_f)) } return &u } func (u MUserPosterBatchDo) Preload(fields ...field.RelationField) IUserPosterBatchDo { for _, _f := range fields { u = *u.withDO(u.DO.Preload(_f)) } return &u } func (u MUserPosterBatchDo) FirstOrInit() (*entity.UserPosterBatch, error) { if result, err := u.DO.FirstOrInit(); err != nil { return nil, err } else { return result.(*entity.UserPosterBatch), nil } } func (u MUserPosterBatchDo) FirstOrCreate() (*entity.UserPosterBatch, error) { if result, err := u.DO.FirstOrCreate(); err != nil { return nil, err } else { return result.(*entity.UserPosterBatch), nil } } func (u MUserPosterBatchDo) FindByPage(offset int, limit int) (result []*entity.UserPosterBatch, count int64, err error) { result, err = u.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 = u.Offset(-1).Limit(-1).Count() return } func (u MUserPosterBatchDo) ScanByPage(result interface{}, offset int, limit int) (count int64, err error) { count, err = u.Count() if err != nil { return } err = u.Offset(offset).Limit(limit).Scan(result) return } func (u MUserPosterBatchDo) Scan(result interface{}) (err error) { return u.DO.Scan(result) } func (u MUserPosterBatchDo) Delete(models ...*entity.UserPosterBatch) (result gen.ResultInfo, err error) { return u.DO.Delete(models) } func (u *MUserPosterBatchDo) withDO(do gen.Dao) *MUserPosterBatchDo { u.DO = *do.(*gen.DO) return u }