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.

364 lines
9.4 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 newGameTotal(db *gorm.DB, opts ...gen.DOOption) gameTotal {
_gameTotal := gameTotal{}
_gameTotal.gameTotalDo.UseDB(db, opts...)
_gameTotal.gameTotalDo.UseModel(&model.GameTotal{})
tableName := _gameTotal.gameTotalDo.TableName()
_gameTotal.ALL = field.NewAsterisk(tableName)
_gameTotal.ID = field.NewInt64(tableName, "id")
_gameTotal.CreatedAt = field.NewInt64(tableName, "created_at")
_gameTotal.UpdatedAt = field.NewInt64(tableName, "updated_at")
_gameTotal.ProjectID = field.NewInt64(tableName, "project_id")
_gameTotal.GameID = field.NewInt64(tableName, "game_id")
_gameTotal.LinkID = field.NewInt64(tableName, "link_id")
_gameTotal.Pv = field.NewInt64(tableName, "pv")
_gameTotal.Uv = field.NewInt64(tableName, "uv")
_gameTotal.Psec = field.NewInt64(tableName, "psec")
_gameTotal.fillFieldMap()
return _gameTotal
}
type gameTotal struct {
gameTotalDo gameTotalDo
ALL field.Asterisk
ID field.Int64
CreatedAt field.Int64
UpdatedAt field.Int64
ProjectID field.Int64 // 项目id
GameID field.Int64 // 游戏id
LinkID field.Int64 // 链接id
Pv field.Int64
Uv field.Int64
Psec field.Int64
fieldMap map[string]field.Expr
}
func (g gameTotal) Table(newTableName string) *gameTotal {
g.gameTotalDo.UseTable(newTableName)
return g.updateTableName(newTableName)
}
func (g gameTotal) As(alias string) *gameTotal {
g.gameTotalDo.DO = *(g.gameTotalDo.As(alias).(*gen.DO))
return g.updateTableName(alias)
}
func (g *gameTotal) updateTableName(table string) *gameTotal {
g.ALL = field.NewAsterisk(table)
g.ID = field.NewInt64(table, "id")
g.CreatedAt = field.NewInt64(table, "created_at")
g.UpdatedAt = field.NewInt64(table, "updated_at")
g.ProjectID = field.NewInt64(table, "project_id")
g.GameID = field.NewInt64(table, "game_id")
g.LinkID = field.NewInt64(table, "link_id")
g.Pv = field.NewInt64(table, "pv")
g.Uv = field.NewInt64(table, "uv")
g.Psec = field.NewInt64(table, "psec")
g.fillFieldMap()
return g
}
func (g *gameTotal) WithContext(ctx context.Context) *gameTotalDo {
return g.gameTotalDo.WithContext(ctx)
}
func (g gameTotal) TableName() string { return g.gameTotalDo.TableName() }
func (g gameTotal) Alias() string { return g.gameTotalDo.Alias() }
func (g *gameTotal) GetFieldByName(fieldName string) (field.OrderExpr, bool) {
_f, ok := g.fieldMap[fieldName]
if !ok || _f == nil {
return nil, false
}
_oe, ok := _f.(field.OrderExpr)
return _oe, ok
}
func (g *gameTotal) fillFieldMap() {
g.fieldMap = make(map[string]field.Expr, 9)
g.fieldMap["id"] = g.ID
g.fieldMap["created_at"] = g.CreatedAt
g.fieldMap["updated_at"] = g.UpdatedAt
g.fieldMap["project_id"] = g.ProjectID
g.fieldMap["game_id"] = g.GameID
g.fieldMap["link_id"] = g.LinkID
g.fieldMap["pv"] = g.Pv
g.fieldMap["uv"] = g.Uv
g.fieldMap["psec"] = g.Psec
}
func (g gameTotal) clone(db *gorm.DB) gameTotal {
g.gameTotalDo.ReplaceConnPool(db.Statement.ConnPool)
return g
}
func (g gameTotal) replaceDB(db *gorm.DB) gameTotal {
g.gameTotalDo.ReplaceDB(db)
return g
}
type gameTotalDo struct{ gen.DO }
func (g gameTotalDo) Debug() *gameTotalDo {
return g.withDO(g.DO.Debug())
}
func (g gameTotalDo) WithContext(ctx context.Context) *gameTotalDo {
return g.withDO(g.DO.WithContext(ctx))
}
func (g gameTotalDo) ReadDB() *gameTotalDo {
return g.Clauses(dbresolver.Read)
}
func (g gameTotalDo) WriteDB() *gameTotalDo {
return g.Clauses(dbresolver.Write)
}
func (g gameTotalDo) Session(config *gorm.Session) *gameTotalDo {
return g.withDO(g.DO.Session(config))
}
func (g gameTotalDo) Clauses(conds ...clause.Expression) *gameTotalDo {
return g.withDO(g.DO.Clauses(conds...))
}
func (g gameTotalDo) Returning(value interface{}, columns ...string) *gameTotalDo {
return g.withDO(g.DO.Returning(value, columns...))
}
func (g gameTotalDo) Not(conds ...gen.Condition) *gameTotalDo {
return g.withDO(g.DO.Not(conds...))
}
func (g gameTotalDo) Or(conds ...gen.Condition) *gameTotalDo {
return g.withDO(g.DO.Or(conds...))
}
func (g gameTotalDo) Select(conds ...field.Expr) *gameTotalDo {
return g.withDO(g.DO.Select(conds...))
}
func (g gameTotalDo) Where(conds ...gen.Condition) *gameTotalDo {
return g.withDO(g.DO.Where(conds...))
}
func (g gameTotalDo) Exists(subquery interface{ UnderlyingDB() *gorm.DB }) *gameTotalDo {
return g.Where(field.CompareSubQuery(field.ExistsOp, nil, subquery.UnderlyingDB()))
}
func (g gameTotalDo) Order(conds ...field.Expr) *gameTotalDo {
return g.withDO(g.DO.Order(conds...))
}
func (g gameTotalDo) Distinct(cols ...field.Expr) *gameTotalDo {
return g.withDO(g.DO.Distinct(cols...))
}
func (g gameTotalDo) Omit(cols ...field.Expr) *gameTotalDo {
return g.withDO(g.DO.Omit(cols...))
}
func (g gameTotalDo) Join(table schema.Tabler, on ...field.Expr) *gameTotalDo {
return g.withDO(g.DO.Join(table, on...))
}
func (g gameTotalDo) LeftJoin(table schema.Tabler, on ...field.Expr) *gameTotalDo {
return g.withDO(g.DO.LeftJoin(table, on...))
}
func (g gameTotalDo) RightJoin(table schema.Tabler, on ...field.Expr) *gameTotalDo {
return g.withDO(g.DO.RightJoin(table, on...))
}
func (g gameTotalDo) Group(cols ...field.Expr) *gameTotalDo {
return g.withDO(g.DO.Group(cols...))
}
func (g gameTotalDo) Having(conds ...gen.Condition) *gameTotalDo {
return g.withDO(g.DO.Having(conds...))
}
func (g gameTotalDo) Limit(limit int) *gameTotalDo {
return g.withDO(g.DO.Limit(limit))
}
func (g gameTotalDo) Offset(offset int) *gameTotalDo {
return g.withDO(g.DO.Offset(offset))
}
func (g gameTotalDo) Scopes(funcs ...func(gen.Dao) gen.Dao) *gameTotalDo {
return g.withDO(g.DO.Scopes(funcs...))
}
func (g gameTotalDo) Unscoped() *gameTotalDo {
return g.withDO(g.DO.Unscoped())
}
func (g gameTotalDo) Create(values ...*model.GameTotal) error {
if len(values) == 0 {
return nil
}
return g.DO.Create(values)
}
func (g gameTotalDo) CreateInBatches(values []*model.GameTotal, batchSize int) error {
return g.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 (g gameTotalDo) Save(values ...*model.GameTotal) error {
if len(values) == 0 {
return nil
}
return g.DO.Save(values)
}
func (g gameTotalDo) First() (*model.GameTotal, error) {
if result, err := g.DO.First(); err != nil {
return nil, err
} else {
return result.(*model.GameTotal), nil
}
}
func (g gameTotalDo) Take() (*model.GameTotal, error) {
if result, err := g.DO.Take(); err != nil {
return nil, err
} else {
return result.(*model.GameTotal), nil
}
}
func (g gameTotalDo) Last() (*model.GameTotal, error) {
if result, err := g.DO.Last(); err != nil {
return nil, err
} else {
return result.(*model.GameTotal), nil
}
}
func (g gameTotalDo) Find() ([]*model.GameTotal, error) {
result, err := g.DO.Find()
return result.([]*model.GameTotal), err
}
func (g gameTotalDo) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*model.GameTotal, err error) {
buf := make([]*model.GameTotal, 0, batchSize)
err = g.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 (g gameTotalDo) FindInBatches(result *[]*model.GameTotal, batchSize int, fc func(tx gen.Dao, batch int) error) error {
return g.DO.FindInBatches(result, batchSize, fc)
}
func (g gameTotalDo) Attrs(attrs ...field.AssignExpr) *gameTotalDo {
return g.withDO(g.DO.Attrs(attrs...))
}
func (g gameTotalDo) Assign(attrs ...field.AssignExpr) *gameTotalDo {
return g.withDO(g.DO.Assign(attrs...))
}
func (g gameTotalDo) Joins(fields ...field.RelationField) *gameTotalDo {
for _, _f := range fields {
g = *g.withDO(g.DO.Joins(_f))
}
return &g
}
func (g gameTotalDo) Preload(fields ...field.RelationField) *gameTotalDo {
for _, _f := range fields {
g = *g.withDO(g.DO.Preload(_f))
}
return &g
}
func (g gameTotalDo) FirstOrInit() (*model.GameTotal, error) {
if result, err := g.DO.FirstOrInit(); err != nil {
return nil, err
} else {
return result.(*model.GameTotal), nil
}
}
func (g gameTotalDo) FirstOrCreate() (*model.GameTotal, error) {
if result, err := g.DO.FirstOrCreate(); err != nil {
return nil, err
} else {
return result.(*model.GameTotal), nil
}
}
func (g gameTotalDo) FindByPage(offset int, limit int) (result []*model.GameTotal, count int64, err error) {
result, err = g.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 = g.Offset(-1).Limit(-1).Count()
return
}
func (g gameTotalDo) ScanByPage(result interface{}, offset int, limit int) (count int64, err error) {
count, err = g.Count()
if err != nil {
return
}
err = g.Offset(offset).Limit(limit).Scan(result)
return
}
func (g gameTotalDo) Scan(result interface{}) (err error) {
return g.DO.Scan(result)
}
func (g gameTotalDo) Delete(models ...*model.GameTotal) (result gen.ResultInfo, err error) {
return g.DO.Delete(models)
}
func (g *gameTotalDo) withDO(do gen.Dao) *gameTotalDo {
g.DO = *do.(*gen.DO)
return g
}