report_day_adv_basic.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 newReportDayAdvBasic(db *gorm.DB, opts ...gen.DOOption) reportDayAdvBasic {
  16. _reportDayAdvBasic := reportDayAdvBasic{}
  17. _reportDayAdvBasic.reportDayAdvBasicDo.UseDB(db, opts...)
  18. _reportDayAdvBasic.reportDayAdvBasicDo.UseModel(&model.ReportDayAdvBasic{})
  19. tableName := _reportDayAdvBasic.reportDayAdvBasicDo.TableName()
  20. _reportDayAdvBasic.ALL = field.NewAsterisk(tableName)
  21. _reportDayAdvBasic.ID = field.NewInt64(tableName, "id")
  22. _reportDayAdvBasic.Date = field.NewString(tableName, "date")
  23. _reportDayAdvBasic.PositionID = field.NewInt64(tableName, "position_id")
  24. _reportDayAdvBasic.ChannelID = field.NewString(tableName, "channel_id")
  25. _reportDayAdvBasic.ServerID = field.NewInt32(tableName, "server_id")
  26. _reportDayAdvBasic.Flag = field.NewInt32(tableName, "flag")
  27. _reportDayAdvBasic.Name = field.NewString(tableName, "name")
  28. _reportDayAdvBasic.ShowTimes = field.NewInt64(tableName, "show_times")
  29. _reportDayAdvBasic.ClickTimes = field.NewInt64(tableName, "click_times")
  30. _reportDayAdvBasic.RewardTimes = field.NewInt64(tableName, "reward_times")
  31. _reportDayAdvBasic.ShowUsers = field.NewInt64(tableName, "show_users")
  32. _reportDayAdvBasic.ClickUsers = field.NewInt64(tableName, "click_users")
  33. _reportDayAdvBasic.RewardUsers = field.NewInt64(tableName, "reward_users")
  34. _reportDayAdvBasic.CreatedAt = field.NewInt64(tableName, "created_at")
  35. _reportDayAdvBasic.UpdatedAt = field.NewInt64(tableName, "updated_at")
  36. _reportDayAdvBasic.fillFieldMap()
  37. return _reportDayAdvBasic
  38. }
  39. type reportDayAdvBasic struct {
  40. reportDayAdvBasicDo
  41. ALL field.Asterisk
  42. ID field.Int64
  43. Date field.String
  44. PositionID field.Int64 // 条件编号
  45. ChannelID field.String // 渠道ID
  46. ServerID field.Int32 // 服务器ID
  47. Flag field.Int32
  48. Name field.String // 条件名称
  49. ShowTimes field.Int64
  50. ClickTimes field.Int64
  51. RewardTimes field.Int64
  52. ShowUsers field.Int64
  53. ClickUsers field.Int64
  54. RewardUsers field.Int64
  55. CreatedAt field.Int64
  56. UpdatedAt field.Int64
  57. fieldMap map[string]field.Expr
  58. }
  59. func (r reportDayAdvBasic) Table(newTableName string) *reportDayAdvBasic {
  60. r.reportDayAdvBasicDo.UseTable(newTableName)
  61. return r.updateTableName(newTableName)
  62. }
  63. func (r reportDayAdvBasic) As(alias string) *reportDayAdvBasic {
  64. r.reportDayAdvBasicDo.DO = *(r.reportDayAdvBasicDo.As(alias).(*gen.DO))
  65. return r.updateTableName(alias)
  66. }
  67. func (r *reportDayAdvBasic) updateTableName(table string) *reportDayAdvBasic {
  68. r.ALL = field.NewAsterisk(table)
  69. r.ID = field.NewInt64(table, "id")
  70. r.Date = field.NewString(table, "date")
  71. r.PositionID = field.NewInt64(table, "position_id")
  72. r.ChannelID = field.NewString(table, "channel_id")
  73. r.ServerID = field.NewInt32(table, "server_id")
  74. r.Flag = field.NewInt32(table, "flag")
  75. r.Name = field.NewString(table, "name")
  76. r.ShowTimes = field.NewInt64(table, "show_times")
  77. r.ClickTimes = field.NewInt64(table, "click_times")
  78. r.RewardTimes = field.NewInt64(table, "reward_times")
  79. r.ShowUsers = field.NewInt64(table, "show_users")
  80. r.ClickUsers = field.NewInt64(table, "click_users")
  81. r.RewardUsers = field.NewInt64(table, "reward_users")
  82. r.CreatedAt = field.NewInt64(table, "created_at")
  83. r.UpdatedAt = field.NewInt64(table, "updated_at")
  84. r.fillFieldMap()
  85. return r
  86. }
  87. func (r *reportDayAdvBasic) 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 *reportDayAdvBasic) 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["position_id"] = r.PositionID
  100. r.fieldMap["channel_id"] = r.ChannelID
  101. r.fieldMap["server_id"] = r.ServerID
  102. r.fieldMap["flag"] = r.Flag
  103. r.fieldMap["name"] = r.Name
  104. r.fieldMap["show_times"] = r.ShowTimes
  105. r.fieldMap["click_times"] = r.ClickTimes
  106. r.fieldMap["reward_times"] = r.RewardTimes
  107. r.fieldMap["show_users"] = r.ShowUsers
  108. r.fieldMap["click_users"] = r.ClickUsers
  109. r.fieldMap["reward_users"] = r.RewardUsers
  110. r.fieldMap["created_at"] = r.CreatedAt
  111. r.fieldMap["updated_at"] = r.UpdatedAt
  112. }
  113. func (r reportDayAdvBasic) clone(db *gorm.DB) reportDayAdvBasic {
  114. r.reportDayAdvBasicDo.ReplaceConnPool(db.Statement.ConnPool)
  115. return r
  116. }
  117. func (r reportDayAdvBasic) replaceDB(db *gorm.DB) reportDayAdvBasic {
  118. r.reportDayAdvBasicDo.ReplaceDB(db)
  119. return r
  120. }
  121. type reportDayAdvBasicDo struct{ gen.DO }
  122. func (r reportDayAdvBasicDo) Debug() *reportDayAdvBasicDo {
  123. return r.withDO(r.DO.Debug())
  124. }
  125. func (r reportDayAdvBasicDo) WithContext(ctx context.Context) *reportDayAdvBasicDo {
  126. return r.withDO(r.DO.WithContext(ctx))
  127. }
  128. func (r reportDayAdvBasicDo) ReadDB() *reportDayAdvBasicDo {
  129. return r.Clauses(dbresolver.Read)
  130. }
  131. func (r reportDayAdvBasicDo) WriteDB() *reportDayAdvBasicDo {
  132. return r.Clauses(dbresolver.Write)
  133. }
  134. func (r reportDayAdvBasicDo) Session(config *gorm.Session) *reportDayAdvBasicDo {
  135. return r.withDO(r.DO.Session(config))
  136. }
  137. func (r reportDayAdvBasicDo) Clauses(conds ...clause.Expression) *reportDayAdvBasicDo {
  138. return r.withDO(r.DO.Clauses(conds...))
  139. }
  140. func (r reportDayAdvBasicDo) Returning(value interface{}, columns ...string) *reportDayAdvBasicDo {
  141. return r.withDO(r.DO.Returning(value, columns...))
  142. }
  143. func (r reportDayAdvBasicDo) Not(conds ...gen.Condition) *reportDayAdvBasicDo {
  144. return r.withDO(r.DO.Not(conds...))
  145. }
  146. func (r reportDayAdvBasicDo) Or(conds ...gen.Condition) *reportDayAdvBasicDo {
  147. return r.withDO(r.DO.Or(conds...))
  148. }
  149. func (r reportDayAdvBasicDo) Select(conds ...field.Expr) *reportDayAdvBasicDo {
  150. return r.withDO(r.DO.Select(conds...))
  151. }
  152. func (r reportDayAdvBasicDo) Where(conds ...gen.Condition) *reportDayAdvBasicDo {
  153. return r.withDO(r.DO.Where(conds...))
  154. }
  155. func (r reportDayAdvBasicDo) Exists(subquery interface{ UnderlyingDB() *gorm.DB }) *reportDayAdvBasicDo {
  156. return r.Where(field.CompareSubQuery(field.ExistsOp, nil, subquery.UnderlyingDB()))
  157. }
  158. func (r reportDayAdvBasicDo) Order(conds ...field.Expr) *reportDayAdvBasicDo {
  159. return r.withDO(r.DO.Order(conds...))
  160. }
  161. func (r reportDayAdvBasicDo) Distinct(cols ...field.Expr) *reportDayAdvBasicDo {
  162. return r.withDO(r.DO.Distinct(cols...))
  163. }
  164. func (r reportDayAdvBasicDo) Omit(cols ...field.Expr) *reportDayAdvBasicDo {
  165. return r.withDO(r.DO.Omit(cols...))
  166. }
  167. func (r reportDayAdvBasicDo) Join(table schema.Tabler, on ...field.Expr) *reportDayAdvBasicDo {
  168. return r.withDO(r.DO.Join(table, on...))
  169. }
  170. func (r reportDayAdvBasicDo) LeftJoin(table schema.Tabler, on ...field.Expr) *reportDayAdvBasicDo {
  171. return r.withDO(r.DO.LeftJoin(table, on...))
  172. }
  173. func (r reportDayAdvBasicDo) RightJoin(table schema.Tabler, on ...field.Expr) *reportDayAdvBasicDo {
  174. return r.withDO(r.DO.RightJoin(table, on...))
  175. }
  176. func (r reportDayAdvBasicDo) Group(cols ...field.Expr) *reportDayAdvBasicDo {
  177. return r.withDO(r.DO.Group(cols...))
  178. }
  179. func (r reportDayAdvBasicDo) Having(conds ...gen.Condition) *reportDayAdvBasicDo {
  180. return r.withDO(r.DO.Having(conds...))
  181. }
  182. func (r reportDayAdvBasicDo) Limit(limit int) *reportDayAdvBasicDo {
  183. return r.withDO(r.DO.Limit(limit))
  184. }
  185. func (r reportDayAdvBasicDo) Offset(offset int) *reportDayAdvBasicDo {
  186. return r.withDO(r.DO.Offset(offset))
  187. }
  188. func (r reportDayAdvBasicDo) Scopes(funcs ...func(gen.Dao) gen.Dao) *reportDayAdvBasicDo {
  189. return r.withDO(r.DO.Scopes(funcs...))
  190. }
  191. func (r reportDayAdvBasicDo) Unscoped() *reportDayAdvBasicDo {
  192. return r.withDO(r.DO.Unscoped())
  193. }
  194. func (r reportDayAdvBasicDo) Create(values ...*model.ReportDayAdvBasic) error {
  195. if len(values) == 0 {
  196. return nil
  197. }
  198. return r.DO.Create(values)
  199. }
  200. func (r reportDayAdvBasicDo) CreateInBatches(values []*model.ReportDayAdvBasic, 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 reportDayAdvBasicDo) Save(values ...*model.ReportDayAdvBasic) error {
  206. if len(values) == 0 {
  207. return nil
  208. }
  209. return r.DO.Save(values)
  210. }
  211. func (r reportDayAdvBasicDo) First() (*model.ReportDayAdvBasic, error) {
  212. if result, err := r.DO.First(); err != nil {
  213. return nil, err
  214. } else {
  215. return result.(*model.ReportDayAdvBasic), nil
  216. }
  217. }
  218. func (r reportDayAdvBasicDo) Take() (*model.ReportDayAdvBasic, error) {
  219. if result, err := r.DO.Take(); err != nil {
  220. return nil, err
  221. } else {
  222. return result.(*model.ReportDayAdvBasic), nil
  223. }
  224. }
  225. func (r reportDayAdvBasicDo) Last() (*model.ReportDayAdvBasic, error) {
  226. if result, err := r.DO.Last(); err != nil {
  227. return nil, err
  228. } else {
  229. return result.(*model.ReportDayAdvBasic), nil
  230. }
  231. }
  232. func (r reportDayAdvBasicDo) Find() ([]*model.ReportDayAdvBasic, error) {
  233. result, err := r.DO.Find()
  234. return result.([]*model.ReportDayAdvBasic), err
  235. }
  236. func (r reportDayAdvBasicDo) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*model.ReportDayAdvBasic, err error) {
  237. buf := make([]*model.ReportDayAdvBasic, 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 reportDayAdvBasicDo) FindInBatches(result *[]*model.ReportDayAdvBasic, batchSize int, fc func(tx gen.Dao, batch int) error) error {
  245. return r.DO.FindInBatches(result, batchSize, fc)
  246. }
  247. func (r reportDayAdvBasicDo) Attrs(attrs ...field.AssignExpr) *reportDayAdvBasicDo {
  248. return r.withDO(r.DO.Attrs(attrs...))
  249. }
  250. func (r reportDayAdvBasicDo) Assign(attrs ...field.AssignExpr) *reportDayAdvBasicDo {
  251. return r.withDO(r.DO.Assign(attrs...))
  252. }
  253. func (r reportDayAdvBasicDo) Joins(fields ...field.RelationField) *reportDayAdvBasicDo {
  254. for _, _f := range fields {
  255. r = *r.withDO(r.DO.Joins(_f))
  256. }
  257. return &r
  258. }
  259. func (r reportDayAdvBasicDo) Preload(fields ...field.RelationField) *reportDayAdvBasicDo {
  260. for _, _f := range fields {
  261. r = *r.withDO(r.DO.Preload(_f))
  262. }
  263. return &r
  264. }
  265. func (r reportDayAdvBasicDo) FirstOrInit() (*model.ReportDayAdvBasic, error) {
  266. if result, err := r.DO.FirstOrInit(); err != nil {
  267. return nil, err
  268. } else {
  269. return result.(*model.ReportDayAdvBasic), nil
  270. }
  271. }
  272. func (r reportDayAdvBasicDo) FirstOrCreate() (*model.ReportDayAdvBasic, error) {
  273. if result, err := r.DO.FirstOrCreate(); err != nil {
  274. return nil, err
  275. } else {
  276. return result.(*model.ReportDayAdvBasic), nil
  277. }
  278. }
  279. func (r reportDayAdvBasicDo) FindByPage(offset int, limit int) (result []*model.ReportDayAdvBasic, 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 reportDayAdvBasicDo) 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 reportDayAdvBasicDo) Scan(result interface{}) (err error) {
  300. return r.DO.Scan(result)
  301. }
  302. func (r reportDayAdvBasicDo) Delete(models ...*model.ReportDayAdvBasic) (result gen.ResultInfo, err error) {
  303. return r.DO.Delete(models)
  304. }
  305. func (r *reportDayAdvBasicDo) withDO(do gen.Dao) *reportDayAdvBasicDo {
  306. r.DO = *do.(*gen.DO)
  307. return r
  308. }