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.

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