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