report_day_boss.gen.go 11 KB

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