123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399 |
- // 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 newOrdersRegStat(db *gorm.DB, opts ...gen.DOOption) ordersRegStat {
- _ordersRegStat := ordersRegStat{}
- _ordersRegStat.ordersRegStatDo.UseDB(db, opts...)
- _ordersRegStat.ordersRegStatDo.UseModel(&model.OrdersRegStat{})
- tableName := _ordersRegStat.ordersRegStatDo.TableName()
- _ordersRegStat.ALL = field.NewAsterisk(tableName)
- _ordersRegStat.ID = field.NewInt64(tableName, "id")
- _ordersRegStat.Date = field.NewString(tableName, "date")
- _ordersRegStat.C1 = field.NewInt64(tableName, "c1")
- _ordersRegStat.M1 = field.NewFloat64(tableName, "m1")
- _ordersRegStat.C2 = field.NewInt64(tableName, "c2")
- _ordersRegStat.M2 = field.NewFloat64(tableName, "m2")
- _ordersRegStat.C3 = field.NewInt64(tableName, "c3")
- _ordersRegStat.M3 = field.NewFloat64(tableName, "m3")
- _ordersRegStat.C4 = field.NewInt64(tableName, "c4")
- _ordersRegStat.M4 = field.NewFloat64(tableName, "m4")
- _ordersRegStat.C5 = field.NewInt64(tableName, "c5")
- _ordersRegStat.M5 = field.NewFloat64(tableName, "m5")
- _ordersRegStat.C6 = field.NewInt64(tableName, "c6")
- _ordersRegStat.M6 = field.NewFloat64(tableName, "m6")
- _ordersRegStat.C7 = field.NewInt64(tableName, "c7")
- _ordersRegStat.M7 = field.NewFloat64(tableName, "m7")
- _ordersRegStat.U7 = field.NewInt64(tableName, "u7")
- _ordersRegStat.CreatedAt = field.NewTime(tableName, "created_at")
- _ordersRegStat.ChannelID = field.NewString(tableName, "channel_id")
- _ordersRegStat.ServerID = field.NewInt32(tableName, "server_id")
- _ordersRegStat.fillFieldMap()
- return _ordersRegStat
- }
- type ordersRegStat struct {
- ordersRegStatDo
- ALL field.Asterisk
- ID field.Int64
- Date field.String // 订单日期
- C1 field.Int64 // 当天付费人数
- M1 field.Float64 // 当天付费金额
- C2 field.Int64 // 次日付费人数
- M2 field.Float64 // 次日付费金额
- C3 field.Int64 // 3日付费人数
- M3 field.Float64 // 3日付费金额
- C4 field.Int64 // 4日付费人数
- M4 field.Float64 // 4日付费金额
- C5 field.Int64 // 5日付费人数
- M5 field.Float64 // 5日付费金额
- C6 field.Int64 // 6日付费人数
- M6 field.Float64 // 6日付费金额
- C7 field.Int64 // 7日付费人数
- M7 field.Float64 // 7日付费金额
- U7 field.Int64 // 7日去重付费人数
- CreatedAt field.Time // 创建时间
- ChannelID field.String // 渠道ID
- ServerID field.Int32 // 服务器ID
- fieldMap map[string]field.Expr
- }
- func (o ordersRegStat) Table(newTableName string) *ordersRegStat {
- o.ordersRegStatDo.UseTable(newTableName)
- return o.updateTableName(newTableName)
- }
- func (o ordersRegStat) As(alias string) *ordersRegStat {
- o.ordersRegStatDo.DO = *(o.ordersRegStatDo.As(alias).(*gen.DO))
- return o.updateTableName(alias)
- }
- func (o *ordersRegStat) updateTableName(table string) *ordersRegStat {
- o.ALL = field.NewAsterisk(table)
- o.ID = field.NewInt64(table, "id")
- o.Date = field.NewString(table, "date")
- o.C1 = field.NewInt64(table, "c1")
- o.M1 = field.NewFloat64(table, "m1")
- o.C2 = field.NewInt64(table, "c2")
- o.M2 = field.NewFloat64(table, "m2")
- o.C3 = field.NewInt64(table, "c3")
- o.M3 = field.NewFloat64(table, "m3")
- o.C4 = field.NewInt64(table, "c4")
- o.M4 = field.NewFloat64(table, "m4")
- o.C5 = field.NewInt64(table, "c5")
- o.M5 = field.NewFloat64(table, "m5")
- o.C6 = field.NewInt64(table, "c6")
- o.M6 = field.NewFloat64(table, "m6")
- o.C7 = field.NewInt64(table, "c7")
- o.M7 = field.NewFloat64(table, "m7")
- o.U7 = field.NewInt64(table, "u7")
- o.CreatedAt = field.NewTime(table, "created_at")
- o.ChannelID = field.NewString(table, "channel_id")
- o.ServerID = field.NewInt32(table, "server_id")
- o.fillFieldMap()
- return o
- }
- func (o *ordersRegStat) GetFieldByName(fieldName string) (field.OrderExpr, bool) {
- _f, ok := o.fieldMap[fieldName]
- if !ok || _f == nil {
- return nil, false
- }
- _oe, ok := _f.(field.OrderExpr)
- return _oe, ok
- }
- func (o *ordersRegStat) fillFieldMap() {
- o.fieldMap = make(map[string]field.Expr, 20)
- o.fieldMap["id"] = o.ID
- o.fieldMap["date"] = o.Date
- o.fieldMap["c1"] = o.C1
- o.fieldMap["m1"] = o.M1
- o.fieldMap["c2"] = o.C2
- o.fieldMap["m2"] = o.M2
- o.fieldMap["c3"] = o.C3
- o.fieldMap["m3"] = o.M3
- o.fieldMap["c4"] = o.C4
- o.fieldMap["m4"] = o.M4
- o.fieldMap["c5"] = o.C5
- o.fieldMap["m5"] = o.M5
- o.fieldMap["c6"] = o.C6
- o.fieldMap["m6"] = o.M6
- o.fieldMap["c7"] = o.C7
- o.fieldMap["m7"] = o.M7
- o.fieldMap["u7"] = o.U7
- o.fieldMap["created_at"] = o.CreatedAt
- o.fieldMap["channel_id"] = o.ChannelID
- o.fieldMap["server_id"] = o.ServerID
- }
- func (o ordersRegStat) clone(db *gorm.DB) ordersRegStat {
- o.ordersRegStatDo.ReplaceConnPool(db.Statement.ConnPool)
- return o
- }
- func (o ordersRegStat) replaceDB(db *gorm.DB) ordersRegStat {
- o.ordersRegStatDo.ReplaceDB(db)
- return o
- }
- type ordersRegStatDo struct{ gen.DO }
- func (o ordersRegStatDo) Debug() *ordersRegStatDo {
- return o.withDO(o.DO.Debug())
- }
- func (o ordersRegStatDo) WithContext(ctx context.Context) *ordersRegStatDo {
- return o.withDO(o.DO.WithContext(ctx))
- }
- func (o ordersRegStatDo) ReadDB() *ordersRegStatDo {
- return o.Clauses(dbresolver.Read)
- }
- func (o ordersRegStatDo) WriteDB() *ordersRegStatDo {
- return o.Clauses(dbresolver.Write)
- }
- func (o ordersRegStatDo) Session(config *gorm.Session) *ordersRegStatDo {
- return o.withDO(o.DO.Session(config))
- }
- func (o ordersRegStatDo) Clauses(conds ...clause.Expression) *ordersRegStatDo {
- return o.withDO(o.DO.Clauses(conds...))
- }
- func (o ordersRegStatDo) Returning(value interface{}, columns ...string) *ordersRegStatDo {
- return o.withDO(o.DO.Returning(value, columns...))
- }
- func (o ordersRegStatDo) Not(conds ...gen.Condition) *ordersRegStatDo {
- return o.withDO(o.DO.Not(conds...))
- }
- func (o ordersRegStatDo) Or(conds ...gen.Condition) *ordersRegStatDo {
- return o.withDO(o.DO.Or(conds...))
- }
- func (o ordersRegStatDo) Select(conds ...field.Expr) *ordersRegStatDo {
- return o.withDO(o.DO.Select(conds...))
- }
- func (o ordersRegStatDo) Where(conds ...gen.Condition) *ordersRegStatDo {
- return o.withDO(o.DO.Where(conds...))
- }
- func (o ordersRegStatDo) Exists(subquery interface{ UnderlyingDB() *gorm.DB }) *ordersRegStatDo {
- return o.Where(field.CompareSubQuery(field.ExistsOp, nil, subquery.UnderlyingDB()))
- }
- func (o ordersRegStatDo) Order(conds ...field.Expr) *ordersRegStatDo {
- return o.withDO(o.DO.Order(conds...))
- }
- func (o ordersRegStatDo) Distinct(cols ...field.Expr) *ordersRegStatDo {
- return o.withDO(o.DO.Distinct(cols...))
- }
- func (o ordersRegStatDo) Omit(cols ...field.Expr) *ordersRegStatDo {
- return o.withDO(o.DO.Omit(cols...))
- }
- func (o ordersRegStatDo) Join(table schema.Tabler, on ...field.Expr) *ordersRegStatDo {
- return o.withDO(o.DO.Join(table, on...))
- }
- func (o ordersRegStatDo) LeftJoin(table schema.Tabler, on ...field.Expr) *ordersRegStatDo {
- return o.withDO(o.DO.LeftJoin(table, on...))
- }
- func (o ordersRegStatDo) RightJoin(table schema.Tabler, on ...field.Expr) *ordersRegStatDo {
- return o.withDO(o.DO.RightJoin(table, on...))
- }
- func (o ordersRegStatDo) Group(cols ...field.Expr) *ordersRegStatDo {
- return o.withDO(o.DO.Group(cols...))
- }
- func (o ordersRegStatDo) Having(conds ...gen.Condition) *ordersRegStatDo {
- return o.withDO(o.DO.Having(conds...))
- }
- func (o ordersRegStatDo) Limit(limit int) *ordersRegStatDo {
- return o.withDO(o.DO.Limit(limit))
- }
- func (o ordersRegStatDo) Offset(offset int) *ordersRegStatDo {
- return o.withDO(o.DO.Offset(offset))
- }
- func (o ordersRegStatDo) Scopes(funcs ...func(gen.Dao) gen.Dao) *ordersRegStatDo {
- return o.withDO(o.DO.Scopes(funcs...))
- }
- func (o ordersRegStatDo) Unscoped() *ordersRegStatDo {
- return o.withDO(o.DO.Unscoped())
- }
- func (o ordersRegStatDo) Create(values ...*model.OrdersRegStat) error {
- if len(values) == 0 {
- return nil
- }
- return o.DO.Create(values)
- }
- func (o ordersRegStatDo) CreateInBatches(values []*model.OrdersRegStat, batchSize int) error {
- return o.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 (o ordersRegStatDo) Save(values ...*model.OrdersRegStat) error {
- if len(values) == 0 {
- return nil
- }
- return o.DO.Save(values)
- }
- func (o ordersRegStatDo) First() (*model.OrdersRegStat, error) {
- if result, err := o.DO.First(); err != nil {
- return nil, err
- } else {
- return result.(*model.OrdersRegStat), nil
- }
- }
- func (o ordersRegStatDo) Take() (*model.OrdersRegStat, error) {
- if result, err := o.DO.Take(); err != nil {
- return nil, err
- } else {
- return result.(*model.OrdersRegStat), nil
- }
- }
- func (o ordersRegStatDo) Last() (*model.OrdersRegStat, error) {
- if result, err := o.DO.Last(); err != nil {
- return nil, err
- } else {
- return result.(*model.OrdersRegStat), nil
- }
- }
- func (o ordersRegStatDo) Find() ([]*model.OrdersRegStat, error) {
- result, err := o.DO.Find()
- return result.([]*model.OrdersRegStat), err
- }
- func (o ordersRegStatDo) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*model.OrdersRegStat, err error) {
- buf := make([]*model.OrdersRegStat, 0, batchSize)
- err = o.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 (o ordersRegStatDo) FindInBatches(result *[]*model.OrdersRegStat, batchSize int, fc func(tx gen.Dao, batch int) error) error {
- return o.DO.FindInBatches(result, batchSize, fc)
- }
- func (o ordersRegStatDo) Attrs(attrs ...field.AssignExpr) *ordersRegStatDo {
- return o.withDO(o.DO.Attrs(attrs...))
- }
- func (o ordersRegStatDo) Assign(attrs ...field.AssignExpr) *ordersRegStatDo {
- return o.withDO(o.DO.Assign(attrs...))
- }
- func (o ordersRegStatDo) Joins(fields ...field.RelationField) *ordersRegStatDo {
- for _, _f := range fields {
- o = *o.withDO(o.DO.Joins(_f))
- }
- return &o
- }
- func (o ordersRegStatDo) Preload(fields ...field.RelationField) *ordersRegStatDo {
- for _, _f := range fields {
- o = *o.withDO(o.DO.Preload(_f))
- }
- return &o
- }
- func (o ordersRegStatDo) FirstOrInit() (*model.OrdersRegStat, error) {
- if result, err := o.DO.FirstOrInit(); err != nil {
- return nil, err
- } else {
- return result.(*model.OrdersRegStat), nil
- }
- }
- func (o ordersRegStatDo) FirstOrCreate() (*model.OrdersRegStat, error) {
- if result, err := o.DO.FirstOrCreate(); err != nil {
- return nil, err
- } else {
- return result.(*model.OrdersRegStat), nil
- }
- }
- func (o ordersRegStatDo) FindByPage(offset int, limit int) (result []*model.OrdersRegStat, count int64, err error) {
- result, err = o.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 = o.Offset(-1).Limit(-1).Count()
- return
- }
- func (o ordersRegStatDo) ScanByPage(result interface{}, offset int, limit int) (count int64, err error) {
- count, err = o.Count()
- if err != nil {
- return
- }
- err = o.Offset(offset).Limit(limit).Scan(result)
- return
- }
- func (o ordersRegStatDo) Scan(result interface{}) (err error) {
- return o.DO.Scan(result)
- }
- func (o ordersRegStatDo) Delete(models ...*model.OrdersRegStat) (result gen.ResultInfo, err error) {
- return o.DO.Delete(models)
- }
- func (o *ordersRegStatDo) withDO(do gen.Dao) *ordersRegStatDo {
- o.DO = *do.(*gen.DO)
- return o
- }
|