123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375 |
- // 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 query
- import (
- "context"
- "gorm.io/gorm"
- "gorm.io/gorm/clause"
- "gorm.io/gorm/schema"
- "gorm.io/gen"
- "gorm.io/gen/field"
- "gorm.io/plugin/dbresolver"
- "gadmin/internal/gorm/model"
- )
- func newReportDayGoodsBasic(db *gorm.DB, opts ...gen.DOOption) reportDayGoodsBasic {
- _reportDayGoodsBasic := reportDayGoodsBasic{}
- _reportDayGoodsBasic.reportDayGoodsBasicDo.UseDB(db, opts...)
- _reportDayGoodsBasic.reportDayGoodsBasicDo.UseModel(&model.ReportDayGoodsBasic{})
- tableName := _reportDayGoodsBasic.reportDayGoodsBasicDo.TableName()
- _reportDayGoodsBasic.ALL = field.NewAsterisk(tableName)
- _reportDayGoodsBasic.ID = field.NewInt64(tableName, "id")
- _reportDayGoodsBasic.Date = field.NewString(tableName, "date")
- _reportDayGoodsBasic.PositionID = field.NewInt64(tableName, "position_id")
- _reportDayGoodsBasic.ChannelID = field.NewString(tableName, "channel_id")
- _reportDayGoodsBasic.ServerID = field.NewInt32(tableName, "server_id")
- _reportDayGoodsBasic.Name = field.NewString(tableName, "name")
- _reportDayGoodsBasic.ShowTimes = field.NewInt64(tableName, "show_times")
- _reportDayGoodsBasic.ClickTimes = field.NewInt64(tableName, "click_times")
- _reportDayGoodsBasic.SuccessTimes = field.NewInt64(tableName, "success_times")
- _reportDayGoodsBasic.ShowUsers = field.NewInt64(tableName, "show_users")
- _reportDayGoodsBasic.ClickUsers = field.NewInt64(tableName, "click_users")
- _reportDayGoodsBasic.SuccessUsers = field.NewInt64(tableName, "success_users")
- _reportDayGoodsBasic.CreatedAt = field.NewInt32(tableName, "created_at")
- _reportDayGoodsBasic.UpdatedAt = field.NewInt32(tableName, "updated_at")
- _reportDayGoodsBasic.fillFieldMap()
- return _reportDayGoodsBasic
- }
- type reportDayGoodsBasic struct {
- reportDayGoodsBasicDo
- ALL field.Asterisk
- ID field.Int64
- Date field.String
- PositionID field.Int64 // 条件编号
- ChannelID field.String // 渠道ID
- ServerID field.Int32 // 服务器ID
- Name field.String // 条件名称
- ShowTimes field.Int64
- ClickTimes field.Int64
- SuccessTimes field.Int64
- ShowUsers field.Int64
- ClickUsers field.Int64
- SuccessUsers field.Int64
- CreatedAt field.Int32
- UpdatedAt field.Int32
- fieldMap map[string]field.Expr
- }
- func (r reportDayGoodsBasic) Table(newTableName string) *reportDayGoodsBasic {
- r.reportDayGoodsBasicDo.UseTable(newTableName)
- return r.updateTableName(newTableName)
- }
- func (r reportDayGoodsBasic) As(alias string) *reportDayGoodsBasic {
- r.reportDayGoodsBasicDo.DO = *(r.reportDayGoodsBasicDo.As(alias).(*gen.DO))
- return r.updateTableName(alias)
- }
- func (r *reportDayGoodsBasic) updateTableName(table string) *reportDayGoodsBasic {
- r.ALL = field.NewAsterisk(table)
- r.ID = field.NewInt64(table, "id")
- r.Date = field.NewString(table, "date")
- r.PositionID = field.NewInt64(table, "position_id")
- r.ChannelID = field.NewString(table, "channel_id")
- r.ServerID = field.NewInt32(table, "server_id")
- r.Name = field.NewString(table, "name")
- r.ShowTimes = field.NewInt64(table, "show_times")
- r.ClickTimes = field.NewInt64(table, "click_times")
- r.SuccessTimes = field.NewInt64(table, "success_times")
- r.ShowUsers = field.NewInt64(table, "show_users")
- r.ClickUsers = field.NewInt64(table, "click_users")
- r.SuccessUsers = field.NewInt64(table, "success_users")
- r.CreatedAt = field.NewInt32(table, "created_at")
- r.UpdatedAt = field.NewInt32(table, "updated_at")
- r.fillFieldMap()
- return r
- }
- func (r *reportDayGoodsBasic) 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 *reportDayGoodsBasic) fillFieldMap() {
- r.fieldMap = make(map[string]field.Expr, 14)
- r.fieldMap["id"] = r.ID
- r.fieldMap["date"] = r.Date
- r.fieldMap["position_id"] = r.PositionID
- r.fieldMap["channel_id"] = r.ChannelID
- r.fieldMap["server_id"] = r.ServerID
- r.fieldMap["name"] = r.Name
- r.fieldMap["show_times"] = r.ShowTimes
- r.fieldMap["click_times"] = r.ClickTimes
- r.fieldMap["success_times"] = r.SuccessTimes
- r.fieldMap["show_users"] = r.ShowUsers
- r.fieldMap["click_users"] = r.ClickUsers
- r.fieldMap["success_users"] = r.SuccessUsers
- r.fieldMap["created_at"] = r.CreatedAt
- r.fieldMap["updated_at"] = r.UpdatedAt
- }
- func (r reportDayGoodsBasic) clone(db *gorm.DB) reportDayGoodsBasic {
- r.reportDayGoodsBasicDo.ReplaceConnPool(db.Statement.ConnPool)
- return r
- }
- func (r reportDayGoodsBasic) replaceDB(db *gorm.DB) reportDayGoodsBasic {
- r.reportDayGoodsBasicDo.ReplaceDB(db)
- return r
- }
- type reportDayGoodsBasicDo struct{ gen.DO }
- func (r reportDayGoodsBasicDo) Debug() *reportDayGoodsBasicDo {
- return r.withDO(r.DO.Debug())
- }
- func (r reportDayGoodsBasicDo) WithContext(ctx context.Context) *reportDayGoodsBasicDo {
- return r.withDO(r.DO.WithContext(ctx))
- }
- func (r reportDayGoodsBasicDo) ReadDB() *reportDayGoodsBasicDo {
- return r.Clauses(dbresolver.Read)
- }
- func (r reportDayGoodsBasicDo) WriteDB() *reportDayGoodsBasicDo {
- return r.Clauses(dbresolver.Write)
- }
- func (r reportDayGoodsBasicDo) Session(config *gorm.Session) *reportDayGoodsBasicDo {
- return r.withDO(r.DO.Session(config))
- }
- func (r reportDayGoodsBasicDo) Clauses(conds ...clause.Expression) *reportDayGoodsBasicDo {
- return r.withDO(r.DO.Clauses(conds...))
- }
- func (r reportDayGoodsBasicDo) Returning(value interface{}, columns ...string) *reportDayGoodsBasicDo {
- return r.withDO(r.DO.Returning(value, columns...))
- }
- func (r reportDayGoodsBasicDo) Not(conds ...gen.Condition) *reportDayGoodsBasicDo {
- return r.withDO(r.DO.Not(conds...))
- }
- func (r reportDayGoodsBasicDo) Or(conds ...gen.Condition) *reportDayGoodsBasicDo {
- return r.withDO(r.DO.Or(conds...))
- }
- func (r reportDayGoodsBasicDo) Select(conds ...field.Expr) *reportDayGoodsBasicDo {
- return r.withDO(r.DO.Select(conds...))
- }
- func (r reportDayGoodsBasicDo) Where(conds ...gen.Condition) *reportDayGoodsBasicDo {
- return r.withDO(r.DO.Where(conds...))
- }
- func (r reportDayGoodsBasicDo) Exists(subquery interface{ UnderlyingDB() *gorm.DB }) *reportDayGoodsBasicDo {
- return r.Where(field.CompareSubQuery(field.ExistsOp, nil, subquery.UnderlyingDB()))
- }
- func (r reportDayGoodsBasicDo) Order(conds ...field.Expr) *reportDayGoodsBasicDo {
- return r.withDO(r.DO.Order(conds...))
- }
- func (r reportDayGoodsBasicDo) Distinct(cols ...field.Expr) *reportDayGoodsBasicDo {
- return r.withDO(r.DO.Distinct(cols...))
- }
- func (r reportDayGoodsBasicDo) Omit(cols ...field.Expr) *reportDayGoodsBasicDo {
- return r.withDO(r.DO.Omit(cols...))
- }
- func (r reportDayGoodsBasicDo) Join(table schema.Tabler, on ...field.Expr) *reportDayGoodsBasicDo {
- return r.withDO(r.DO.Join(table, on...))
- }
- func (r reportDayGoodsBasicDo) LeftJoin(table schema.Tabler, on ...field.Expr) *reportDayGoodsBasicDo {
- return r.withDO(r.DO.LeftJoin(table, on...))
- }
- func (r reportDayGoodsBasicDo) RightJoin(table schema.Tabler, on ...field.Expr) *reportDayGoodsBasicDo {
- return r.withDO(r.DO.RightJoin(table, on...))
- }
- func (r reportDayGoodsBasicDo) Group(cols ...field.Expr) *reportDayGoodsBasicDo {
- return r.withDO(r.DO.Group(cols...))
- }
- func (r reportDayGoodsBasicDo) Having(conds ...gen.Condition) *reportDayGoodsBasicDo {
- return r.withDO(r.DO.Having(conds...))
- }
- func (r reportDayGoodsBasicDo) Limit(limit int) *reportDayGoodsBasicDo {
- return r.withDO(r.DO.Limit(limit))
- }
- func (r reportDayGoodsBasicDo) Offset(offset int) *reportDayGoodsBasicDo {
- return r.withDO(r.DO.Offset(offset))
- }
- func (r reportDayGoodsBasicDo) Scopes(funcs ...func(gen.Dao) gen.Dao) *reportDayGoodsBasicDo {
- return r.withDO(r.DO.Scopes(funcs...))
- }
- func (r reportDayGoodsBasicDo) Unscoped() *reportDayGoodsBasicDo {
- return r.withDO(r.DO.Unscoped())
- }
- func (r reportDayGoodsBasicDo) Create(values ...*model.ReportDayGoodsBasic) error {
- if len(values) == 0 {
- return nil
- }
- return r.DO.Create(values)
- }
- func (r reportDayGoodsBasicDo) CreateInBatches(values []*model.ReportDayGoodsBasic, 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 reportDayGoodsBasicDo) Save(values ...*model.ReportDayGoodsBasic) error {
- if len(values) == 0 {
- return nil
- }
- return r.DO.Save(values)
- }
- func (r reportDayGoodsBasicDo) First() (*model.ReportDayGoodsBasic, error) {
- if result, err := r.DO.First(); err != nil {
- return nil, err
- } else {
- return result.(*model.ReportDayGoodsBasic), nil
- }
- }
- func (r reportDayGoodsBasicDo) Take() (*model.ReportDayGoodsBasic, error) {
- if result, err := r.DO.Take(); err != nil {
- return nil, err
- } else {
- return result.(*model.ReportDayGoodsBasic), nil
- }
- }
- func (r reportDayGoodsBasicDo) Last() (*model.ReportDayGoodsBasic, error) {
- if result, err := r.DO.Last(); err != nil {
- return nil, err
- } else {
- return result.(*model.ReportDayGoodsBasic), nil
- }
- }
- func (r reportDayGoodsBasicDo) Find() ([]*model.ReportDayGoodsBasic, error) {
- result, err := r.DO.Find()
- return result.([]*model.ReportDayGoodsBasic), err
- }
- func (r reportDayGoodsBasicDo) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*model.ReportDayGoodsBasic, err error) {
- buf := make([]*model.ReportDayGoodsBasic, 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 reportDayGoodsBasicDo) FindInBatches(result *[]*model.ReportDayGoodsBasic, batchSize int, fc func(tx gen.Dao, batch int) error) error {
- return r.DO.FindInBatches(result, batchSize, fc)
- }
- func (r reportDayGoodsBasicDo) Attrs(attrs ...field.AssignExpr) *reportDayGoodsBasicDo {
- return r.withDO(r.DO.Attrs(attrs...))
- }
- func (r reportDayGoodsBasicDo) Assign(attrs ...field.AssignExpr) *reportDayGoodsBasicDo {
- return r.withDO(r.DO.Assign(attrs...))
- }
- func (r reportDayGoodsBasicDo) Joins(fields ...field.RelationField) *reportDayGoodsBasicDo {
- for _, _f := range fields {
- r = *r.withDO(r.DO.Joins(_f))
- }
- return &r
- }
- func (r reportDayGoodsBasicDo) Preload(fields ...field.RelationField) *reportDayGoodsBasicDo {
- for _, _f := range fields {
- r = *r.withDO(r.DO.Preload(_f))
- }
- return &r
- }
- func (r reportDayGoodsBasicDo) FirstOrInit() (*model.ReportDayGoodsBasic, error) {
- if result, err := r.DO.FirstOrInit(); err != nil {
- return nil, err
- } else {
- return result.(*model.ReportDayGoodsBasic), nil
- }
- }
- func (r reportDayGoodsBasicDo) FirstOrCreate() (*model.ReportDayGoodsBasic, error) {
- if result, err := r.DO.FirstOrCreate(); err != nil {
- return nil, err
- } else {
- return result.(*model.ReportDayGoodsBasic), nil
- }
- }
- func (r reportDayGoodsBasicDo) FindByPage(offset int, limit int) (result []*model.ReportDayGoodsBasic, 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 reportDayGoodsBasicDo) 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 reportDayGoodsBasicDo) Scan(result interface{}) (err error) {
- return r.DO.Scan(result)
- }
- func (r reportDayGoodsBasicDo) Delete(models ...*model.ReportDayGoodsBasic) (result gen.ResultInfo, err error) {
- return r.DO.Delete(models)
- }
- func (r *reportDayGoodsBasicDo) withDO(do gen.Dao) *reportDayGoodsBasicDo {
- r.DO = *do.(*gen.DO)
- return r
- }
|