report_day_expedition.gen.go 11 KB

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