orders_reg_stat.gen.go 11 KB

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