report_day_event_basic.gen.go 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395
  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 newReportDayEventBasic(db *gorm.DB, opts ...gen.DOOption) reportDayEventBasic {
  16. _reportDayEventBasic := reportDayEventBasic{}
  17. _reportDayEventBasic.reportDayEventBasicDo.UseDB(db, opts...)
  18. _reportDayEventBasic.reportDayEventBasicDo.UseModel(&model.ReportDayEventBasic{})
  19. tableName := _reportDayEventBasic.reportDayEventBasicDo.TableName()
  20. _reportDayEventBasic.ALL = field.NewAsterisk(tableName)
  21. _reportDayEventBasic.ID = field.NewInt64(tableName, "id")
  22. _reportDayEventBasic.Date = field.NewString(tableName, "date")
  23. _reportDayEventBasic.ChannelID = field.NewString(tableName, "channel_id")
  24. _reportDayEventBasic.ServerID = field.NewInt32(tableName, "server_id")
  25. _reportDayEventBasic.ConditionID = field.NewInt64(tableName, "condition_id")
  26. _reportDayEventBasic.Name = field.NewString(tableName, "name")
  27. _reportDayEventBasic.Count_ = field.NewInt64(tableName, "count")
  28. _reportDayEventBasic.Active1Day = field.NewInt64(tableName, "active_1_day")
  29. _reportDayEventBasic.Active2Day = field.NewInt64(tableName, "active_2_day")
  30. _reportDayEventBasic.Active3Day = field.NewInt64(tableName, "active_3_day")
  31. _reportDayEventBasic.Active4Day = field.NewInt64(tableName, "active_4_day")
  32. _reportDayEventBasic.Active5Day = field.NewInt64(tableName, "active_5_day")
  33. _reportDayEventBasic.Active6Day = field.NewInt64(tableName, "active_6_day")
  34. _reportDayEventBasic.Active7Day = field.NewInt64(tableName, "active_7_day")
  35. _reportDayEventBasic.Active14Day = field.NewInt64(tableName, "active_14_day")
  36. _reportDayEventBasic.Active30Day = field.NewInt64(tableName, "active_30_day")
  37. _reportDayEventBasic.CreatedAt = field.NewInt32(tableName, "created_at")
  38. _reportDayEventBasic.UpdatedAt = field.NewInt32(tableName, "updated_at")
  39. _reportDayEventBasic.Flag = field.NewInt32(tableName, "flag")
  40. _reportDayEventBasic.fillFieldMap()
  41. return _reportDayEventBasic
  42. }
  43. type reportDayEventBasic struct {
  44. reportDayEventBasicDo
  45. ALL field.Asterisk
  46. ID field.Int64
  47. Date field.String
  48. ChannelID field.String // 渠道ID
  49. ServerID field.Int32 // 服务器ID
  50. ConditionID field.Int64 // 条件编号
  51. Name field.String // 条件名称
  52. Count_ field.Int64 // 新增用户的平均时长
  53. Active1Day field.Int64
  54. Active2Day field.Int64
  55. Active3Day field.Int64
  56. Active4Day field.Int64
  57. Active5Day field.Int64
  58. Active6Day field.Int64
  59. Active7Day field.Int64
  60. Active14Day field.Int64
  61. Active30Day field.Int64
  62. CreatedAt field.Int32
  63. UpdatedAt field.Int32
  64. Flag field.Int32
  65. fieldMap map[string]field.Expr
  66. }
  67. func (r reportDayEventBasic) Table(newTableName string) *reportDayEventBasic {
  68. r.reportDayEventBasicDo.UseTable(newTableName)
  69. return r.updateTableName(newTableName)
  70. }
  71. func (r reportDayEventBasic) As(alias string) *reportDayEventBasic {
  72. r.reportDayEventBasicDo.DO = *(r.reportDayEventBasicDo.As(alias).(*gen.DO))
  73. return r.updateTableName(alias)
  74. }
  75. func (r *reportDayEventBasic) updateTableName(table string) *reportDayEventBasic {
  76. r.ALL = field.NewAsterisk(table)
  77. r.ID = field.NewInt64(table, "id")
  78. r.Date = field.NewString(table, "date")
  79. r.ChannelID = field.NewString(table, "channel_id")
  80. r.ServerID = field.NewInt32(table, "server_id")
  81. r.ConditionID = field.NewInt64(table, "condition_id")
  82. r.Name = field.NewString(table, "name")
  83. r.Count_ = field.NewInt64(table, "count")
  84. r.Active1Day = field.NewInt64(table, "active_1_day")
  85. r.Active2Day = field.NewInt64(table, "active_2_day")
  86. r.Active3Day = field.NewInt64(table, "active_3_day")
  87. r.Active4Day = field.NewInt64(table, "active_4_day")
  88. r.Active5Day = field.NewInt64(table, "active_5_day")
  89. r.Active6Day = field.NewInt64(table, "active_6_day")
  90. r.Active7Day = field.NewInt64(table, "active_7_day")
  91. r.Active14Day = field.NewInt64(table, "active_14_day")
  92. r.Active30Day = field.NewInt64(table, "active_30_day")
  93. r.CreatedAt = field.NewInt32(table, "created_at")
  94. r.UpdatedAt = field.NewInt32(table, "updated_at")
  95. r.Flag = field.NewInt32(table, "flag")
  96. r.fillFieldMap()
  97. return r
  98. }
  99. func (r *reportDayEventBasic) GetFieldByName(fieldName string) (field.OrderExpr, bool) {
  100. _f, ok := r.fieldMap[fieldName]
  101. if !ok || _f == nil {
  102. return nil, false
  103. }
  104. _oe, ok := _f.(field.OrderExpr)
  105. return _oe, ok
  106. }
  107. func (r *reportDayEventBasic) fillFieldMap() {
  108. r.fieldMap = make(map[string]field.Expr, 19)
  109. r.fieldMap["id"] = r.ID
  110. r.fieldMap["date"] = r.Date
  111. r.fieldMap["channel_id"] = r.ChannelID
  112. r.fieldMap["server_id"] = r.ServerID
  113. r.fieldMap["condition_id"] = r.ConditionID
  114. r.fieldMap["name"] = r.Name
  115. r.fieldMap["count"] = r.Count_
  116. r.fieldMap["active_1_day"] = r.Active1Day
  117. r.fieldMap["active_2_day"] = r.Active2Day
  118. r.fieldMap["active_3_day"] = r.Active3Day
  119. r.fieldMap["active_4_day"] = r.Active4Day
  120. r.fieldMap["active_5_day"] = r.Active5Day
  121. r.fieldMap["active_6_day"] = r.Active6Day
  122. r.fieldMap["active_7_day"] = r.Active7Day
  123. r.fieldMap["active_14_day"] = r.Active14Day
  124. r.fieldMap["active_30_day"] = r.Active30Day
  125. r.fieldMap["created_at"] = r.CreatedAt
  126. r.fieldMap["updated_at"] = r.UpdatedAt
  127. r.fieldMap["flag"] = r.Flag
  128. }
  129. func (r reportDayEventBasic) clone(db *gorm.DB) reportDayEventBasic {
  130. r.reportDayEventBasicDo.ReplaceConnPool(db.Statement.ConnPool)
  131. return r
  132. }
  133. func (r reportDayEventBasic) replaceDB(db *gorm.DB) reportDayEventBasic {
  134. r.reportDayEventBasicDo.ReplaceDB(db)
  135. return r
  136. }
  137. type reportDayEventBasicDo struct{ gen.DO }
  138. func (r reportDayEventBasicDo) Debug() *reportDayEventBasicDo {
  139. return r.withDO(r.DO.Debug())
  140. }
  141. func (r reportDayEventBasicDo) WithContext(ctx context.Context) *reportDayEventBasicDo {
  142. return r.withDO(r.DO.WithContext(ctx))
  143. }
  144. func (r reportDayEventBasicDo) ReadDB() *reportDayEventBasicDo {
  145. return r.Clauses(dbresolver.Read)
  146. }
  147. func (r reportDayEventBasicDo) WriteDB() *reportDayEventBasicDo {
  148. return r.Clauses(dbresolver.Write)
  149. }
  150. func (r reportDayEventBasicDo) Session(config *gorm.Session) *reportDayEventBasicDo {
  151. return r.withDO(r.DO.Session(config))
  152. }
  153. func (r reportDayEventBasicDo) Clauses(conds ...clause.Expression) *reportDayEventBasicDo {
  154. return r.withDO(r.DO.Clauses(conds...))
  155. }
  156. func (r reportDayEventBasicDo) Returning(value interface{}, columns ...string) *reportDayEventBasicDo {
  157. return r.withDO(r.DO.Returning(value, columns...))
  158. }
  159. func (r reportDayEventBasicDo) Not(conds ...gen.Condition) *reportDayEventBasicDo {
  160. return r.withDO(r.DO.Not(conds...))
  161. }
  162. func (r reportDayEventBasicDo) Or(conds ...gen.Condition) *reportDayEventBasicDo {
  163. return r.withDO(r.DO.Or(conds...))
  164. }
  165. func (r reportDayEventBasicDo) Select(conds ...field.Expr) *reportDayEventBasicDo {
  166. return r.withDO(r.DO.Select(conds...))
  167. }
  168. func (r reportDayEventBasicDo) Where(conds ...gen.Condition) *reportDayEventBasicDo {
  169. return r.withDO(r.DO.Where(conds...))
  170. }
  171. func (r reportDayEventBasicDo) Exists(subquery interface{ UnderlyingDB() *gorm.DB }) *reportDayEventBasicDo {
  172. return r.Where(field.CompareSubQuery(field.ExistsOp, nil, subquery.UnderlyingDB()))
  173. }
  174. func (r reportDayEventBasicDo) Order(conds ...field.Expr) *reportDayEventBasicDo {
  175. return r.withDO(r.DO.Order(conds...))
  176. }
  177. func (r reportDayEventBasicDo) Distinct(cols ...field.Expr) *reportDayEventBasicDo {
  178. return r.withDO(r.DO.Distinct(cols...))
  179. }
  180. func (r reportDayEventBasicDo) Omit(cols ...field.Expr) *reportDayEventBasicDo {
  181. return r.withDO(r.DO.Omit(cols...))
  182. }
  183. func (r reportDayEventBasicDo) Join(table schema.Tabler, on ...field.Expr) *reportDayEventBasicDo {
  184. return r.withDO(r.DO.Join(table, on...))
  185. }
  186. func (r reportDayEventBasicDo) LeftJoin(table schema.Tabler, on ...field.Expr) *reportDayEventBasicDo {
  187. return r.withDO(r.DO.LeftJoin(table, on...))
  188. }
  189. func (r reportDayEventBasicDo) RightJoin(table schema.Tabler, on ...field.Expr) *reportDayEventBasicDo {
  190. return r.withDO(r.DO.RightJoin(table, on...))
  191. }
  192. func (r reportDayEventBasicDo) Group(cols ...field.Expr) *reportDayEventBasicDo {
  193. return r.withDO(r.DO.Group(cols...))
  194. }
  195. func (r reportDayEventBasicDo) Having(conds ...gen.Condition) *reportDayEventBasicDo {
  196. return r.withDO(r.DO.Having(conds...))
  197. }
  198. func (r reportDayEventBasicDo) Limit(limit int) *reportDayEventBasicDo {
  199. return r.withDO(r.DO.Limit(limit))
  200. }
  201. func (r reportDayEventBasicDo) Offset(offset int) *reportDayEventBasicDo {
  202. return r.withDO(r.DO.Offset(offset))
  203. }
  204. func (r reportDayEventBasicDo) Scopes(funcs ...func(gen.Dao) gen.Dao) *reportDayEventBasicDo {
  205. return r.withDO(r.DO.Scopes(funcs...))
  206. }
  207. func (r reportDayEventBasicDo) Unscoped() *reportDayEventBasicDo {
  208. return r.withDO(r.DO.Unscoped())
  209. }
  210. func (r reportDayEventBasicDo) Create(values ...*model.ReportDayEventBasic) error {
  211. if len(values) == 0 {
  212. return nil
  213. }
  214. return r.DO.Create(values)
  215. }
  216. func (r reportDayEventBasicDo) CreateInBatches(values []*model.ReportDayEventBasic, batchSize int) error {
  217. return r.DO.CreateInBatches(values, batchSize)
  218. }
  219. // Save : !!! underlying implementation is different with GORM
  220. // The method is equivalent to executing the statement: db.Clauses(clause.OnConflict{UpdateAll: true}).Create(values)
  221. func (r reportDayEventBasicDo) Save(values ...*model.ReportDayEventBasic) error {
  222. if len(values) == 0 {
  223. return nil
  224. }
  225. return r.DO.Save(values)
  226. }
  227. func (r reportDayEventBasicDo) First() (*model.ReportDayEventBasic, error) {
  228. if result, err := r.DO.First(); err != nil {
  229. return nil, err
  230. } else {
  231. return result.(*model.ReportDayEventBasic), nil
  232. }
  233. }
  234. func (r reportDayEventBasicDo) Take() (*model.ReportDayEventBasic, error) {
  235. if result, err := r.DO.Take(); err != nil {
  236. return nil, err
  237. } else {
  238. return result.(*model.ReportDayEventBasic), nil
  239. }
  240. }
  241. func (r reportDayEventBasicDo) Last() (*model.ReportDayEventBasic, error) {
  242. if result, err := r.DO.Last(); err != nil {
  243. return nil, err
  244. } else {
  245. return result.(*model.ReportDayEventBasic), nil
  246. }
  247. }
  248. func (r reportDayEventBasicDo) Find() ([]*model.ReportDayEventBasic, error) {
  249. result, err := r.DO.Find()
  250. return result.([]*model.ReportDayEventBasic), err
  251. }
  252. func (r reportDayEventBasicDo) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*model.ReportDayEventBasic, err error) {
  253. buf := make([]*model.ReportDayEventBasic, 0, batchSize)
  254. err = r.DO.FindInBatches(&buf, batchSize, func(tx gen.Dao, batch int) error {
  255. defer func() { results = append(results, buf...) }()
  256. return fc(tx, batch)
  257. })
  258. return results, err
  259. }
  260. func (r reportDayEventBasicDo) FindInBatches(result *[]*model.ReportDayEventBasic, batchSize int, fc func(tx gen.Dao, batch int) error) error {
  261. return r.DO.FindInBatches(result, batchSize, fc)
  262. }
  263. func (r reportDayEventBasicDo) Attrs(attrs ...field.AssignExpr) *reportDayEventBasicDo {
  264. return r.withDO(r.DO.Attrs(attrs...))
  265. }
  266. func (r reportDayEventBasicDo) Assign(attrs ...field.AssignExpr) *reportDayEventBasicDo {
  267. return r.withDO(r.DO.Assign(attrs...))
  268. }
  269. func (r reportDayEventBasicDo) Joins(fields ...field.RelationField) *reportDayEventBasicDo {
  270. for _, _f := range fields {
  271. r = *r.withDO(r.DO.Joins(_f))
  272. }
  273. return &r
  274. }
  275. func (r reportDayEventBasicDo) Preload(fields ...field.RelationField) *reportDayEventBasicDo {
  276. for _, _f := range fields {
  277. r = *r.withDO(r.DO.Preload(_f))
  278. }
  279. return &r
  280. }
  281. func (r reportDayEventBasicDo) FirstOrInit() (*model.ReportDayEventBasic, error) {
  282. if result, err := r.DO.FirstOrInit(); err != nil {
  283. return nil, err
  284. } else {
  285. return result.(*model.ReportDayEventBasic), nil
  286. }
  287. }
  288. func (r reportDayEventBasicDo) FirstOrCreate() (*model.ReportDayEventBasic, error) {
  289. if result, err := r.DO.FirstOrCreate(); err != nil {
  290. return nil, err
  291. } else {
  292. return result.(*model.ReportDayEventBasic), nil
  293. }
  294. }
  295. func (r reportDayEventBasicDo) FindByPage(offset int, limit int) (result []*model.ReportDayEventBasic, count int64, err error) {
  296. result, err = r.Offset(offset).Limit(limit).Find()
  297. if err != nil {
  298. return
  299. }
  300. if size := len(result); 0 < limit && 0 < size && size < limit {
  301. count = int64(size + offset)
  302. return
  303. }
  304. count, err = r.Offset(-1).Limit(-1).Count()
  305. return
  306. }
  307. func (r reportDayEventBasicDo) ScanByPage(result interface{}, offset int, limit int) (count int64, err error) {
  308. count, err = r.Count()
  309. if err != nil {
  310. return
  311. }
  312. err = r.Offset(offset).Limit(limit).Scan(result)
  313. return
  314. }
  315. func (r reportDayEventBasicDo) Scan(result interface{}) (err error) {
  316. return r.DO.Scan(result)
  317. }
  318. func (r reportDayEventBasicDo) Delete(models ...*model.ReportDayEventBasic) (result gen.ResultInfo, err error) {
  319. return r.DO.Delete(models)
  320. }
  321. func (r *reportDayEventBasicDo) withDO(do gen.Dao) *reportDayEventBasicDo {
  322. r.DO = *do.(*gen.DO)
  323. return r
  324. }