You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
344 lines
9.8 KiB
Go
344 lines
9.8 KiB
Go
// 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"
|
|
|
|
"joybuywork/internal/repository/model"
|
|
)
|
|
|
|
func newFissionPointDeduct(db *gorm.DB, opts ...gen.DOOption) fissionPointDeduct {
|
|
_fissionPointDeduct := fissionPointDeduct{}
|
|
|
|
_fissionPointDeduct.fissionPointDeductDo.UseDB(db, opts...)
|
|
_fissionPointDeduct.fissionPointDeductDo.UseModel(&model.FissionPointDeduct{})
|
|
|
|
tableName := _fissionPointDeduct.fissionPointDeductDo.TableName()
|
|
_fissionPointDeduct.ALL = field.NewAsterisk(tableName)
|
|
_fissionPointDeduct.ID = field.NewInt64(tableName, "id")
|
|
_fissionPointDeduct.CreatedAt = field.NewInt64(tableName, "created_at")
|
|
_fissionPointDeduct.UserID = field.NewInt64(tableName, "user_id")
|
|
_fissionPointDeduct.Num = field.NewInt32(tableName, "num")
|
|
|
|
_fissionPointDeduct.fillFieldMap()
|
|
|
|
return _fissionPointDeduct
|
|
}
|
|
|
|
type fissionPointDeduct struct {
|
|
fissionPointDeductDo fissionPointDeductDo
|
|
|
|
ALL field.Asterisk
|
|
ID field.Int64
|
|
CreatedAt field.Int64
|
|
UserID field.Int64
|
|
Num field.Int32 // 扣除数量
|
|
|
|
fieldMap map[string]field.Expr
|
|
}
|
|
|
|
func (f fissionPointDeduct) Table(newTableName string) *fissionPointDeduct {
|
|
f.fissionPointDeductDo.UseTable(newTableName)
|
|
return f.updateTableName(newTableName)
|
|
}
|
|
|
|
func (f fissionPointDeduct) As(alias string) *fissionPointDeduct {
|
|
f.fissionPointDeductDo.DO = *(f.fissionPointDeductDo.As(alias).(*gen.DO))
|
|
return f.updateTableName(alias)
|
|
}
|
|
|
|
func (f *fissionPointDeduct) updateTableName(table string) *fissionPointDeduct {
|
|
f.ALL = field.NewAsterisk(table)
|
|
f.ID = field.NewInt64(table, "id")
|
|
f.CreatedAt = field.NewInt64(table, "created_at")
|
|
f.UserID = field.NewInt64(table, "user_id")
|
|
f.Num = field.NewInt32(table, "num")
|
|
|
|
f.fillFieldMap()
|
|
|
|
return f
|
|
}
|
|
|
|
func (f *fissionPointDeduct) WithContext(ctx context.Context) *fissionPointDeductDo {
|
|
return f.fissionPointDeductDo.WithContext(ctx)
|
|
}
|
|
|
|
func (f fissionPointDeduct) TableName() string { return f.fissionPointDeductDo.TableName() }
|
|
|
|
func (f fissionPointDeduct) Alias() string { return f.fissionPointDeductDo.Alias() }
|
|
|
|
func (f *fissionPointDeduct) 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 *fissionPointDeduct) fillFieldMap() {
|
|
f.fieldMap = make(map[string]field.Expr, 4)
|
|
f.fieldMap["id"] = f.ID
|
|
f.fieldMap["created_at"] = f.CreatedAt
|
|
f.fieldMap["user_id"] = f.UserID
|
|
f.fieldMap["num"] = f.Num
|
|
}
|
|
|
|
func (f fissionPointDeduct) clone(db *gorm.DB) fissionPointDeduct {
|
|
f.fissionPointDeductDo.ReplaceConnPool(db.Statement.ConnPool)
|
|
return f
|
|
}
|
|
|
|
func (f fissionPointDeduct) replaceDB(db *gorm.DB) fissionPointDeduct {
|
|
f.fissionPointDeductDo.ReplaceDB(db)
|
|
return f
|
|
}
|
|
|
|
type fissionPointDeductDo struct{ gen.DO }
|
|
|
|
func (f fissionPointDeductDo) Debug() *fissionPointDeductDo {
|
|
return f.withDO(f.DO.Debug())
|
|
}
|
|
|
|
func (f fissionPointDeductDo) WithContext(ctx context.Context) *fissionPointDeductDo {
|
|
return f.withDO(f.DO.WithContext(ctx))
|
|
}
|
|
|
|
func (f fissionPointDeductDo) ReadDB() *fissionPointDeductDo {
|
|
return f.Clauses(dbresolver.Read)
|
|
}
|
|
|
|
func (f fissionPointDeductDo) WriteDB() *fissionPointDeductDo {
|
|
return f.Clauses(dbresolver.Write)
|
|
}
|
|
|
|
func (f fissionPointDeductDo) Session(config *gorm.Session) *fissionPointDeductDo {
|
|
return f.withDO(f.DO.Session(config))
|
|
}
|
|
|
|
func (f fissionPointDeductDo) Clauses(conds ...clause.Expression) *fissionPointDeductDo {
|
|
return f.withDO(f.DO.Clauses(conds...))
|
|
}
|
|
|
|
func (f fissionPointDeductDo) Returning(value interface{}, columns ...string) *fissionPointDeductDo {
|
|
return f.withDO(f.DO.Returning(value, columns...))
|
|
}
|
|
|
|
func (f fissionPointDeductDo) Not(conds ...gen.Condition) *fissionPointDeductDo {
|
|
return f.withDO(f.DO.Not(conds...))
|
|
}
|
|
|
|
func (f fissionPointDeductDo) Or(conds ...gen.Condition) *fissionPointDeductDo {
|
|
return f.withDO(f.DO.Or(conds...))
|
|
}
|
|
|
|
func (f fissionPointDeductDo) Select(conds ...field.Expr) *fissionPointDeductDo {
|
|
return f.withDO(f.DO.Select(conds...))
|
|
}
|
|
|
|
func (f fissionPointDeductDo) Where(conds ...gen.Condition) *fissionPointDeductDo {
|
|
return f.withDO(f.DO.Where(conds...))
|
|
}
|
|
|
|
func (f fissionPointDeductDo) Exists(subquery interface{ UnderlyingDB() *gorm.DB }) *fissionPointDeductDo {
|
|
return f.Where(field.CompareSubQuery(field.ExistsOp, nil, subquery.UnderlyingDB()))
|
|
}
|
|
|
|
func (f fissionPointDeductDo) Order(conds ...field.Expr) *fissionPointDeductDo {
|
|
return f.withDO(f.DO.Order(conds...))
|
|
}
|
|
|
|
func (f fissionPointDeductDo) Distinct(cols ...field.Expr) *fissionPointDeductDo {
|
|
return f.withDO(f.DO.Distinct(cols...))
|
|
}
|
|
|
|
func (f fissionPointDeductDo) Omit(cols ...field.Expr) *fissionPointDeductDo {
|
|
return f.withDO(f.DO.Omit(cols...))
|
|
}
|
|
|
|
func (f fissionPointDeductDo) Join(table schema.Tabler, on ...field.Expr) *fissionPointDeductDo {
|
|
return f.withDO(f.DO.Join(table, on...))
|
|
}
|
|
|
|
func (f fissionPointDeductDo) LeftJoin(table schema.Tabler, on ...field.Expr) *fissionPointDeductDo {
|
|
return f.withDO(f.DO.LeftJoin(table, on...))
|
|
}
|
|
|
|
func (f fissionPointDeductDo) RightJoin(table schema.Tabler, on ...field.Expr) *fissionPointDeductDo {
|
|
return f.withDO(f.DO.RightJoin(table, on...))
|
|
}
|
|
|
|
func (f fissionPointDeductDo) Group(cols ...field.Expr) *fissionPointDeductDo {
|
|
return f.withDO(f.DO.Group(cols...))
|
|
}
|
|
|
|
func (f fissionPointDeductDo) Having(conds ...gen.Condition) *fissionPointDeductDo {
|
|
return f.withDO(f.DO.Having(conds...))
|
|
}
|
|
|
|
func (f fissionPointDeductDo) Limit(limit int) *fissionPointDeductDo {
|
|
return f.withDO(f.DO.Limit(limit))
|
|
}
|
|
|
|
func (f fissionPointDeductDo) Offset(offset int) *fissionPointDeductDo {
|
|
return f.withDO(f.DO.Offset(offset))
|
|
}
|
|
|
|
func (f fissionPointDeductDo) Scopes(funcs ...func(gen.Dao) gen.Dao) *fissionPointDeductDo {
|
|
return f.withDO(f.DO.Scopes(funcs...))
|
|
}
|
|
|
|
func (f fissionPointDeductDo) Unscoped() *fissionPointDeductDo {
|
|
return f.withDO(f.DO.Unscoped())
|
|
}
|
|
|
|
func (f fissionPointDeductDo) Create(values ...*model.FissionPointDeduct) error {
|
|
if len(values) == 0 {
|
|
return nil
|
|
}
|
|
return f.DO.Create(values)
|
|
}
|
|
|
|
func (f fissionPointDeductDo) CreateInBatches(values []*model.FissionPointDeduct, 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 fissionPointDeductDo) Save(values ...*model.FissionPointDeduct) error {
|
|
if len(values) == 0 {
|
|
return nil
|
|
}
|
|
return f.DO.Save(values)
|
|
}
|
|
|
|
func (f fissionPointDeductDo) First() (*model.FissionPointDeduct, error) {
|
|
if result, err := f.DO.First(); err != nil {
|
|
return nil, err
|
|
} else {
|
|
return result.(*model.FissionPointDeduct), nil
|
|
}
|
|
}
|
|
|
|
func (f fissionPointDeductDo) Take() (*model.FissionPointDeduct, error) {
|
|
if result, err := f.DO.Take(); err != nil {
|
|
return nil, err
|
|
} else {
|
|
return result.(*model.FissionPointDeduct), nil
|
|
}
|
|
}
|
|
|
|
func (f fissionPointDeductDo) Last() (*model.FissionPointDeduct, error) {
|
|
if result, err := f.DO.Last(); err != nil {
|
|
return nil, err
|
|
} else {
|
|
return result.(*model.FissionPointDeduct), nil
|
|
}
|
|
}
|
|
|
|
func (f fissionPointDeductDo) Find() ([]*model.FissionPointDeduct, error) {
|
|
result, err := f.DO.Find()
|
|
return result.([]*model.FissionPointDeduct), err
|
|
}
|
|
|
|
func (f fissionPointDeductDo) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*model.FissionPointDeduct, err error) {
|
|
buf := make([]*model.FissionPointDeduct, 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 fissionPointDeductDo) FindInBatches(result *[]*model.FissionPointDeduct, batchSize int, fc func(tx gen.Dao, batch int) error) error {
|
|
return f.DO.FindInBatches(result, batchSize, fc)
|
|
}
|
|
|
|
func (f fissionPointDeductDo) Attrs(attrs ...field.AssignExpr) *fissionPointDeductDo {
|
|
return f.withDO(f.DO.Attrs(attrs...))
|
|
}
|
|
|
|
func (f fissionPointDeductDo) Assign(attrs ...field.AssignExpr) *fissionPointDeductDo {
|
|
return f.withDO(f.DO.Assign(attrs...))
|
|
}
|
|
|
|
func (f fissionPointDeductDo) Joins(fields ...field.RelationField) *fissionPointDeductDo {
|
|
for _, _f := range fields {
|
|
f = *f.withDO(f.DO.Joins(_f))
|
|
}
|
|
return &f
|
|
}
|
|
|
|
func (f fissionPointDeductDo) Preload(fields ...field.RelationField) *fissionPointDeductDo {
|
|
for _, _f := range fields {
|
|
f = *f.withDO(f.DO.Preload(_f))
|
|
}
|
|
return &f
|
|
}
|
|
|
|
func (f fissionPointDeductDo) FirstOrInit() (*model.FissionPointDeduct, error) {
|
|
if result, err := f.DO.FirstOrInit(); err != nil {
|
|
return nil, err
|
|
} else {
|
|
return result.(*model.FissionPointDeduct), nil
|
|
}
|
|
}
|
|
|
|
func (f fissionPointDeductDo) FirstOrCreate() (*model.FissionPointDeduct, error) {
|
|
if result, err := f.DO.FirstOrCreate(); err != nil {
|
|
return nil, err
|
|
} else {
|
|
return result.(*model.FissionPointDeduct), nil
|
|
}
|
|
}
|
|
|
|
func (f fissionPointDeductDo) FindByPage(offset int, limit int) (result []*model.FissionPointDeduct, 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 fissionPointDeductDo) 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 fissionPointDeductDo) Scan(result interface{}) (err error) {
|
|
return f.DO.Scan(result)
|
|
}
|
|
|
|
func (f fissionPointDeductDo) Delete(models ...*model.FissionPointDeduct) (result gen.ResultInfo, err error) {
|
|
return f.DO.Delete(models)
|
|
}
|
|
|
|
func (f *fissionPointDeductDo) withDO(do gen.Dao) *fissionPointDeductDo {
|
|
f.DO = *do.(*gen.DO)
|
|
return f
|
|
}
|