report_day_duel.gen.go 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383
  1. // Code generated by gorm.io/gen. DO NOT EDIT.
  2. // Code generated by gorm.io/gen. DO NOT EDIT.
  3. // Code generated by gorm.io/gen. DO NOT EDIT.
  4. package query
  5. import (
  6. "context"
  7. "gorm.io/gorm"
  8. "gorm.io/gorm/clause"
  9. "gorm.io/gorm/schema"
  10. "gorm.io/gen"
  11. "gorm.io/gen/field"
  12. "gorm.io/plugin/dbresolver"
  13. "gadmin/internal/gorm/model"
  14. )
  15. func newReportDayDuel(db *gorm.DB, opts ...gen.DOOption) reportDayDuel {
  16. _reportDayDuel := reportDayDuel{}
  17. _reportDayDuel.reportDayDuelDo.UseDB(db, opts...)
  18. _reportDayDuel.reportDayDuelDo.UseModel(&model.ReportDayDuel{})
  19. tableName := _reportDayDuel.reportDayDuelDo.TableName()
  20. _reportDayDuel.ALL = field.NewAsterisk(tableName)
  21. _reportDayDuel.ID = field.NewInt64(tableName, "id")
  22. _reportDayDuel.Date = field.NewString(tableName, "date")
  23. _reportDayDuel.ChannelID = field.NewString(tableName, "channel_id")
  24. _reportDayDuel.ServerID = field.NewInt64(tableName, "server_id")
  25. _reportDayDuel.PlayerCount = field.NewInt64(tableName, "player_count")
  26. _reportDayDuel.RefreshCount = field.NewInt64(tableName, "refresh_count")
  27. _reportDayDuel.DuelCount = field.NewInt64(tableName, "duel_count")
  28. _reportDayDuel.DuelFreeCount = field.NewInt64(tableName, "duel_free_count")
  29. _reportDayDuel.DuelBattleCount = field.NewInt64(tableName, "duel_battle_count")
  30. _reportDayDuel.DuelRevengeCount = field.NewInt64(tableName, "duel_revenge_count")
  31. _reportDayDuel.BattleAdvCount = field.NewInt64(tableName, "battle_adv_count")
  32. _reportDayDuel.BattleDrillCount = field.NewInt64(tableName, "battle_drill_count")
  33. _reportDayDuel.AdjustmentCount = field.NewInt64(tableName, "adjustment_count")
  34. _reportDayDuel.RevengeCount = field.NewInt64(tableName, "revenge_count")
  35. _reportDayDuel.RankingCount = field.NewInt64(tableName, "ranking_count")
  36. _reportDayDuel.AwardCount = field.NewInt64(tableName, "award_count")
  37. _reportDayDuel.fillFieldMap()
  38. return _reportDayDuel
  39. }
  40. type reportDayDuel struct {
  41. reportDayDuelDo
  42. ALL field.Asterisk
  43. ID field.Int64 // ID
  44. Date field.String // 日期
  45. ChannelID field.String // 渠道ID
  46. ServerID field.Int64 // 服务器ID
  47. PlayerCount field.Int64 // 参与人数
  48. RefreshCount field.Int64 // 刷新对手
  49. DuelCount field.Int64 // 对决次数
  50. DuelFreeCount field.Int64 // 免费对决次数
  51. DuelBattleCount field.Int64 // 战帖对决次数
  52. DuelRevengeCount field.Int64 // 复仇对决次数
  53. BattleAdvCount field.Int64 // 看广告获得战帖次数
  54. BattleDrillCount field.Int64 // 钻石获得战帖次数
  55. AdjustmentCount field.Int64 // 调整角色
  56. RevengeCount field.Int64 // 复仇次数
  57. RankingCount field.Int64 // 查看排行榜次数
  58. AwardCount field.Int64 // 查看排行榜奖励次数
  59. fieldMap map[string]field.Expr
  60. }
  61. func (r reportDayDuel) Table(newTableName string) *reportDayDuel {
  62. r.reportDayDuelDo.UseTable(newTableName)
  63. return r.updateTableName(newTableName)
  64. }
  65. func (r reportDayDuel) As(alias string) *reportDayDuel {
  66. r.reportDayDuelDo.DO = *(r.reportDayDuelDo.As(alias).(*gen.DO))
  67. return r.updateTableName(alias)
  68. }
  69. func (r *reportDayDuel) updateTableName(table string) *reportDayDuel {
  70. r.ALL = field.NewAsterisk(table)
  71. r.ID = field.NewInt64(table, "id")
  72. r.Date = field.NewString(table, "date")
  73. r.ChannelID = field.NewString(table, "channel_id")
  74. r.ServerID = field.NewInt64(table, "server_id")
  75. r.PlayerCount = field.NewInt64(table, "player_count")
  76. r.RefreshCount = field.NewInt64(table, "refresh_count")
  77. r.DuelCount = field.NewInt64(table, "duel_count")
  78. r.DuelFreeCount = field.NewInt64(table, "duel_free_count")
  79. r.DuelBattleCount = field.NewInt64(table, "duel_battle_count")
  80. r.DuelRevengeCount = field.NewInt64(table, "duel_revenge_count")
  81. r.BattleAdvCount = field.NewInt64(table, "battle_adv_count")
  82. r.BattleDrillCount = field.NewInt64(table, "battle_drill_count")
  83. r.AdjustmentCount = field.NewInt64(table, "adjustment_count")
  84. r.RevengeCount = field.NewInt64(table, "revenge_count")
  85. r.RankingCount = field.NewInt64(table, "ranking_count")
  86. r.AwardCount = field.NewInt64(table, "award_count")
  87. r.fillFieldMap()
  88. return r
  89. }
  90. func (r *reportDayDuel) GetFieldByName(fieldName string) (field.OrderExpr, bool) {
  91. _f, ok := r.fieldMap[fieldName]
  92. if !ok || _f == nil {
  93. return nil, false
  94. }
  95. _oe, ok := _f.(field.OrderExpr)
  96. return _oe, ok
  97. }
  98. func (r *reportDayDuel) fillFieldMap() {
  99. r.fieldMap = make(map[string]field.Expr, 16)
  100. r.fieldMap["id"] = r.ID
  101. r.fieldMap["date"] = r.Date
  102. r.fieldMap["channel_id"] = r.ChannelID
  103. r.fieldMap["server_id"] = r.ServerID
  104. r.fieldMap["player_count"] = r.PlayerCount
  105. r.fieldMap["refresh_count"] = r.RefreshCount
  106. r.fieldMap["duel_count"] = r.DuelCount
  107. r.fieldMap["duel_free_count"] = r.DuelFreeCount
  108. r.fieldMap["duel_battle_count"] = r.DuelBattleCount
  109. r.fieldMap["duel_revenge_count"] = r.DuelRevengeCount
  110. r.fieldMap["battle_adv_count"] = r.BattleAdvCount
  111. r.fieldMap["battle_drill_count"] = r.BattleDrillCount
  112. r.fieldMap["adjustment_count"] = r.AdjustmentCount
  113. r.fieldMap["revenge_count"] = r.RevengeCount
  114. r.fieldMap["ranking_count"] = r.RankingCount
  115. r.fieldMap["award_count"] = r.AwardCount
  116. }
  117. func (r reportDayDuel) clone(db *gorm.DB) reportDayDuel {
  118. r.reportDayDuelDo.ReplaceConnPool(db.Statement.ConnPool)
  119. return r
  120. }
  121. func (r reportDayDuel) replaceDB(db *gorm.DB) reportDayDuel {
  122. r.reportDayDuelDo.ReplaceDB(db)
  123. return r
  124. }
  125. type reportDayDuelDo struct{ gen.DO }
  126. func (r reportDayDuelDo) Debug() *reportDayDuelDo {
  127. return r.withDO(r.DO.Debug())
  128. }
  129. func (r reportDayDuelDo) WithContext(ctx context.Context) *reportDayDuelDo {
  130. return r.withDO(r.DO.WithContext(ctx))
  131. }
  132. func (r reportDayDuelDo) ReadDB() *reportDayDuelDo {
  133. return r.Clauses(dbresolver.Read)
  134. }
  135. func (r reportDayDuelDo) WriteDB() *reportDayDuelDo {
  136. return r.Clauses(dbresolver.Write)
  137. }
  138. func (r reportDayDuelDo) Session(config *gorm.Session) *reportDayDuelDo {
  139. return r.withDO(r.DO.Session(config))
  140. }
  141. func (r reportDayDuelDo) Clauses(conds ...clause.Expression) *reportDayDuelDo {
  142. return r.withDO(r.DO.Clauses(conds...))
  143. }
  144. func (r reportDayDuelDo) Returning(value interface{}, columns ...string) *reportDayDuelDo {
  145. return r.withDO(r.DO.Returning(value, columns...))
  146. }
  147. func (r reportDayDuelDo) Not(conds ...gen.Condition) *reportDayDuelDo {
  148. return r.withDO(r.DO.Not(conds...))
  149. }
  150. func (r reportDayDuelDo) Or(conds ...gen.Condition) *reportDayDuelDo {
  151. return r.withDO(r.DO.Or(conds...))
  152. }
  153. func (r reportDayDuelDo) Select(conds ...field.Expr) *reportDayDuelDo {
  154. return r.withDO(r.DO.Select(conds...))
  155. }
  156. func (r reportDayDuelDo) Where(conds ...gen.Condition) *reportDayDuelDo {
  157. return r.withDO(r.DO.Where(conds...))
  158. }
  159. func (r reportDayDuelDo) Exists(subquery interface{ UnderlyingDB() *gorm.DB }) *reportDayDuelDo {
  160. return r.Where(field.CompareSubQuery(field.ExistsOp, nil, subquery.UnderlyingDB()))
  161. }
  162. func (r reportDayDuelDo) Order(conds ...field.Expr) *reportDayDuelDo {
  163. return r.withDO(r.DO.Order(conds...))
  164. }
  165. func (r reportDayDuelDo) Distinct(cols ...field.Expr) *reportDayDuelDo {
  166. return r.withDO(r.DO.Distinct(cols...))
  167. }
  168. func (r reportDayDuelDo) Omit(cols ...field.Expr) *reportDayDuelDo {
  169. return r.withDO(r.DO.Omit(cols...))
  170. }
  171. func (r reportDayDuelDo) Join(table schema.Tabler, on ...field.Expr) *reportDayDuelDo {
  172. return r.withDO(r.DO.Join(table, on...))
  173. }
  174. func (r reportDayDuelDo) LeftJoin(table schema.Tabler, on ...field.Expr) *reportDayDuelDo {
  175. return r.withDO(r.DO.LeftJoin(table, on...))
  176. }
  177. func (r reportDayDuelDo) RightJoin(table schema.Tabler, on ...field.Expr) *reportDayDuelDo {
  178. return r.withDO(r.DO.RightJoin(table, on...))
  179. }
  180. func (r reportDayDuelDo) Group(cols ...field.Expr) *reportDayDuelDo {
  181. return r.withDO(r.DO.Group(cols...))
  182. }
  183. func (r reportDayDuelDo) Having(conds ...gen.Condition) *reportDayDuelDo {
  184. return r.withDO(r.DO.Having(conds...))
  185. }
  186. func (r reportDayDuelDo) Limit(limit int) *reportDayDuelDo {
  187. return r.withDO(r.DO.Limit(limit))
  188. }
  189. func (r reportDayDuelDo) Offset(offset int) *reportDayDuelDo {
  190. return r.withDO(r.DO.Offset(offset))
  191. }
  192. func (r reportDayDuelDo) Scopes(funcs ...func(gen.Dao) gen.Dao) *reportDayDuelDo {
  193. return r.withDO(r.DO.Scopes(funcs...))
  194. }
  195. func (r reportDayDuelDo) Unscoped() *reportDayDuelDo {
  196. return r.withDO(r.DO.Unscoped())
  197. }
  198. func (r reportDayDuelDo) Create(values ...*model.ReportDayDuel) error {
  199. if len(values) == 0 {
  200. return nil
  201. }
  202. return r.DO.Create(values)
  203. }
  204. func (r reportDayDuelDo) CreateInBatches(values []*model.ReportDayDuel, batchSize int) error {
  205. return r.DO.CreateInBatches(values, batchSize)
  206. }
  207. // Save : !!! underlying implementation is different with GORM
  208. // The method is equivalent to executing the statement: db.Clauses(clause.OnConflict{UpdateAll: true}).Create(values)
  209. func (r reportDayDuelDo) Save(values ...*model.ReportDayDuel) error {
  210. if len(values) == 0 {
  211. return nil
  212. }
  213. return r.DO.Save(values)
  214. }
  215. func (r reportDayDuelDo) First() (*model.ReportDayDuel, error) {
  216. if result, err := r.DO.First(); err != nil {
  217. return nil, err
  218. } else {
  219. return result.(*model.ReportDayDuel), nil
  220. }
  221. }
  222. func (r reportDayDuelDo) Take() (*model.ReportDayDuel, error) {
  223. if result, err := r.DO.Take(); err != nil {
  224. return nil, err
  225. } else {
  226. return result.(*model.ReportDayDuel), nil
  227. }
  228. }
  229. func (r reportDayDuelDo) Last() (*model.ReportDayDuel, error) {
  230. if result, err := r.DO.Last(); err != nil {
  231. return nil, err
  232. } else {
  233. return result.(*model.ReportDayDuel), nil
  234. }
  235. }
  236. func (r reportDayDuelDo) Find() ([]*model.ReportDayDuel, error) {
  237. result, err := r.DO.Find()
  238. return result.([]*model.ReportDayDuel), err
  239. }
  240. func (r reportDayDuelDo) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*model.ReportDayDuel, err error) {
  241. buf := make([]*model.ReportDayDuel, 0, batchSize)
  242. err = r.DO.FindInBatches(&buf, batchSize, func(tx gen.Dao, batch int) error {
  243. defer func() { results = append(results, buf...) }()
  244. return fc(tx, batch)
  245. })
  246. return results, err
  247. }
  248. func (r reportDayDuelDo) FindInBatches(result *[]*model.ReportDayDuel, batchSize int, fc func(tx gen.Dao, batch int) error) error {
  249. return r.DO.FindInBatches(result, batchSize, fc)
  250. }
  251. func (r reportDayDuelDo) Attrs(attrs ...field.AssignExpr) *reportDayDuelDo {
  252. return r.withDO(r.DO.Attrs(attrs...))
  253. }
  254. func (r reportDayDuelDo) Assign(attrs ...field.AssignExpr) *reportDayDuelDo {
  255. return r.withDO(r.DO.Assign(attrs...))
  256. }
  257. func (r reportDayDuelDo) Joins(fields ...field.RelationField) *reportDayDuelDo {
  258. for _, _f := range fields {
  259. r = *r.withDO(r.DO.Joins(_f))
  260. }
  261. return &r
  262. }
  263. func (r reportDayDuelDo) Preload(fields ...field.RelationField) *reportDayDuelDo {
  264. for _, _f := range fields {
  265. r = *r.withDO(r.DO.Preload(_f))
  266. }
  267. return &r
  268. }
  269. func (r reportDayDuelDo) FirstOrInit() (*model.ReportDayDuel, error) {
  270. if result, err := r.DO.FirstOrInit(); err != nil {
  271. return nil, err
  272. } else {
  273. return result.(*model.ReportDayDuel), nil
  274. }
  275. }
  276. func (r reportDayDuelDo) FirstOrCreate() (*model.ReportDayDuel, error) {
  277. if result, err := r.DO.FirstOrCreate(); err != nil {
  278. return nil, err
  279. } else {
  280. return result.(*model.ReportDayDuel), nil
  281. }
  282. }
  283. func (r reportDayDuelDo) FindByPage(offset int, limit int) (result []*model.ReportDayDuel, count int64, err error) {
  284. result, err = r.Offset(offset).Limit(limit).Find()
  285. if err != nil {
  286. return
  287. }
  288. if size := len(result); 0 < limit && 0 < size && size < limit {
  289. count = int64(size + offset)
  290. return
  291. }
  292. count, err = r.Offset(-1).Limit(-1).Count()
  293. return
  294. }
  295. func (r reportDayDuelDo) ScanByPage(result interface{}, offset int, limit int) (count int64, err error) {
  296. count, err = r.Count()
  297. if err != nil {
  298. return
  299. }
  300. err = r.Offset(offset).Limit(limit).Scan(result)
  301. return
  302. }
  303. func (r reportDayDuelDo) Scan(result interface{}) (err error) {
  304. return r.DO.Scan(result)
  305. }
  306. func (r reportDayDuelDo) Delete(models ...*model.ReportDayDuel) (result gen.ResultInfo, err error) {
  307. return r.DO.Delete(models)
  308. }
  309. func (r *reportDayDuelDo) withDO(do gen.Dao) *reportDayDuelDo {
  310. r.DO = *do.(*gen.DO)
  311. return r
  312. }