report_day_idiom.gen.go 11 KB

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