report_day_disconnect.gen.go 13 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 newReportDayDisconnect(db *gorm.DB, opts ...gen.DOOption) reportDayDisconnect {
  16. _reportDayDisconnect := reportDayDisconnect{}
  17. _reportDayDisconnect.reportDayDisconnectDo.UseDB(db, opts...)
  18. _reportDayDisconnect.reportDayDisconnectDo.UseModel(&model.ReportDayDisconnect{})
  19. tableName := _reportDayDisconnect.reportDayDisconnectDo.TableName()
  20. _reportDayDisconnect.ALL = field.NewAsterisk(tableName)
  21. _reportDayDisconnect.ID = field.NewInt64(tableName, "id")
  22. _reportDayDisconnect.Date = field.NewString(tableName, "date")
  23. _reportDayDisconnect.ChannelID = field.NewString(tableName, "channel_id")
  24. _reportDayDisconnect.ServerID = field.NewInt32(tableName, "server_id")
  25. _reportDayDisconnect.DisCount = field.NewInt64(tableName, "dis_count")
  26. _reportDayDisconnect.DisUsers = field.NewInt64(tableName, "dis_users")
  27. _reportDayDisconnect.ReCount = field.NewInt64(tableName, "re_count")
  28. _reportDayDisconnect.ReUsers = field.NewInt64(tableName, "re_users")
  29. _reportDayDisconnect.NewDisCount = field.NewInt64(tableName, "new_dis_count")
  30. _reportDayDisconnect.NewDisUsers = field.NewInt64(tableName, "new_dis_users")
  31. _reportDayDisconnect.NewReCount = field.NewInt64(tableName, "new_re_count")
  32. _reportDayDisconnect.NewReUsers = field.NewInt64(tableName, "new_re_users")
  33. _reportDayDisconnect.MobileDisCount = field.NewInt64(tableName, "mobile_dis_count")
  34. _reportDayDisconnect.MobileDisUsers = field.NewInt64(tableName, "mobile_dis_users")
  35. _reportDayDisconnect.MobileReCount = field.NewInt64(tableName, "mobile_re_count")
  36. _reportDayDisconnect.MobileReUsers = field.NewInt64(tableName, "mobile_re_users")
  37. _reportDayDisconnect.WifiDisCount = field.NewInt64(tableName, "wifi_dis_count")
  38. _reportDayDisconnect.WifiDisUsers = field.NewInt64(tableName, "wifi_dis_users")
  39. _reportDayDisconnect.WifiReCount = field.NewInt64(tableName, "wifi_re_count")
  40. _reportDayDisconnect.WifiReUsers = field.NewInt64(tableName, "wifi_re_users")
  41. _reportDayDisconnect.fillFieldMap()
  42. return _reportDayDisconnect
  43. }
  44. type reportDayDisconnect struct {
  45. reportDayDisconnectDo
  46. ALL field.Asterisk
  47. ID field.Int64 // ID
  48. Date field.String // 日期
  49. ChannelID field.String // 渠道ID
  50. ServerID field.Int32 // 服务器ID
  51. DisCount field.Int64 // 断线次数
  52. DisUsers field.Int64 // 断线人数
  53. ReCount field.Int64 // 重连次数
  54. ReUsers field.Int64 // 重连人数
  55. NewDisCount field.Int64 // 新手断线次数
  56. NewDisUsers field.Int64 // 新手断线人数
  57. NewReCount field.Int64 // 新手重连次数
  58. NewReUsers field.Int64 // 新手重连人数
  59. MobileDisCount field.Int64 // 移动网断线次数
  60. MobileDisUsers field.Int64 // 移动网断线人数
  61. MobileReCount field.Int64 // 移动网重连次数
  62. MobileReUsers field.Int64 // 移动网重连人数
  63. WifiDisCount field.Int64 // wifi网断线次数
  64. WifiDisUsers field.Int64 // wifi断线人数
  65. WifiReCount field.Int64 // wifi重连次数
  66. WifiReUsers field.Int64 // wifi重连人数
  67. fieldMap map[string]field.Expr
  68. }
  69. func (r reportDayDisconnect) Table(newTableName string) *reportDayDisconnect {
  70. r.reportDayDisconnectDo.UseTable(newTableName)
  71. return r.updateTableName(newTableName)
  72. }
  73. func (r reportDayDisconnect) As(alias string) *reportDayDisconnect {
  74. r.reportDayDisconnectDo.DO = *(r.reportDayDisconnectDo.As(alias).(*gen.DO))
  75. return r.updateTableName(alias)
  76. }
  77. func (r *reportDayDisconnect) updateTableName(table string) *reportDayDisconnect {
  78. r.ALL = field.NewAsterisk(table)
  79. r.ID = field.NewInt64(table, "id")
  80. r.Date = field.NewString(table, "date")
  81. r.ChannelID = field.NewString(table, "channel_id")
  82. r.ServerID = field.NewInt32(table, "server_id")
  83. r.DisCount = field.NewInt64(table, "dis_count")
  84. r.DisUsers = field.NewInt64(table, "dis_users")
  85. r.ReCount = field.NewInt64(table, "re_count")
  86. r.ReUsers = field.NewInt64(table, "re_users")
  87. r.NewDisCount = field.NewInt64(table, "new_dis_count")
  88. r.NewDisUsers = field.NewInt64(table, "new_dis_users")
  89. r.NewReCount = field.NewInt64(table, "new_re_count")
  90. r.NewReUsers = field.NewInt64(table, "new_re_users")
  91. r.MobileDisCount = field.NewInt64(table, "mobile_dis_count")
  92. r.MobileDisUsers = field.NewInt64(table, "mobile_dis_users")
  93. r.MobileReCount = field.NewInt64(table, "mobile_re_count")
  94. r.MobileReUsers = field.NewInt64(table, "mobile_re_users")
  95. r.WifiDisCount = field.NewInt64(table, "wifi_dis_count")
  96. r.WifiDisUsers = field.NewInt64(table, "wifi_dis_users")
  97. r.WifiReCount = field.NewInt64(table, "wifi_re_count")
  98. r.WifiReUsers = field.NewInt64(table, "wifi_re_users")
  99. r.fillFieldMap()
  100. return r
  101. }
  102. func (r *reportDayDisconnect) GetFieldByName(fieldName string) (field.OrderExpr, bool) {
  103. _f, ok := r.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 (r *reportDayDisconnect) fillFieldMap() {
  111. r.fieldMap = make(map[string]field.Expr, 20)
  112. r.fieldMap["id"] = r.ID
  113. r.fieldMap["date"] = r.Date
  114. r.fieldMap["channel_id"] = r.ChannelID
  115. r.fieldMap["server_id"] = r.ServerID
  116. r.fieldMap["dis_count"] = r.DisCount
  117. r.fieldMap["dis_users"] = r.DisUsers
  118. r.fieldMap["re_count"] = r.ReCount
  119. r.fieldMap["re_users"] = r.ReUsers
  120. r.fieldMap["new_dis_count"] = r.NewDisCount
  121. r.fieldMap["new_dis_users"] = r.NewDisUsers
  122. r.fieldMap["new_re_count"] = r.NewReCount
  123. r.fieldMap["new_re_users"] = r.NewReUsers
  124. r.fieldMap["mobile_dis_count"] = r.MobileDisCount
  125. r.fieldMap["mobile_dis_users"] = r.MobileDisUsers
  126. r.fieldMap["mobile_re_count"] = r.MobileReCount
  127. r.fieldMap["mobile_re_users"] = r.MobileReUsers
  128. r.fieldMap["wifi_dis_count"] = r.WifiDisCount
  129. r.fieldMap["wifi_dis_users"] = r.WifiDisUsers
  130. r.fieldMap["wifi_re_count"] = r.WifiReCount
  131. r.fieldMap["wifi_re_users"] = r.WifiReUsers
  132. }
  133. func (r reportDayDisconnect) clone(db *gorm.DB) reportDayDisconnect {
  134. r.reportDayDisconnectDo.ReplaceConnPool(db.Statement.ConnPool)
  135. return r
  136. }
  137. func (r reportDayDisconnect) replaceDB(db *gorm.DB) reportDayDisconnect {
  138. r.reportDayDisconnectDo.ReplaceDB(db)
  139. return r
  140. }
  141. type reportDayDisconnectDo struct{ gen.DO }
  142. func (r reportDayDisconnectDo) Debug() *reportDayDisconnectDo {
  143. return r.withDO(r.DO.Debug())
  144. }
  145. func (r reportDayDisconnectDo) WithContext(ctx context.Context) *reportDayDisconnectDo {
  146. return r.withDO(r.DO.WithContext(ctx))
  147. }
  148. func (r reportDayDisconnectDo) ReadDB() *reportDayDisconnectDo {
  149. return r.Clauses(dbresolver.Read)
  150. }
  151. func (r reportDayDisconnectDo) WriteDB() *reportDayDisconnectDo {
  152. return r.Clauses(dbresolver.Write)
  153. }
  154. func (r reportDayDisconnectDo) Session(config *gorm.Session) *reportDayDisconnectDo {
  155. return r.withDO(r.DO.Session(config))
  156. }
  157. func (r reportDayDisconnectDo) Clauses(conds ...clause.Expression) *reportDayDisconnectDo {
  158. return r.withDO(r.DO.Clauses(conds...))
  159. }
  160. func (r reportDayDisconnectDo) Returning(value interface{}, columns ...string) *reportDayDisconnectDo {
  161. return r.withDO(r.DO.Returning(value, columns...))
  162. }
  163. func (r reportDayDisconnectDo) Not(conds ...gen.Condition) *reportDayDisconnectDo {
  164. return r.withDO(r.DO.Not(conds...))
  165. }
  166. func (r reportDayDisconnectDo) Or(conds ...gen.Condition) *reportDayDisconnectDo {
  167. return r.withDO(r.DO.Or(conds...))
  168. }
  169. func (r reportDayDisconnectDo) Select(conds ...field.Expr) *reportDayDisconnectDo {
  170. return r.withDO(r.DO.Select(conds...))
  171. }
  172. func (r reportDayDisconnectDo) Where(conds ...gen.Condition) *reportDayDisconnectDo {
  173. return r.withDO(r.DO.Where(conds...))
  174. }
  175. func (r reportDayDisconnectDo) Exists(subquery interface{ UnderlyingDB() *gorm.DB }) *reportDayDisconnectDo {
  176. return r.Where(field.CompareSubQuery(field.ExistsOp, nil, subquery.UnderlyingDB()))
  177. }
  178. func (r reportDayDisconnectDo) Order(conds ...field.Expr) *reportDayDisconnectDo {
  179. return r.withDO(r.DO.Order(conds...))
  180. }
  181. func (r reportDayDisconnectDo) Distinct(cols ...field.Expr) *reportDayDisconnectDo {
  182. return r.withDO(r.DO.Distinct(cols...))
  183. }
  184. func (r reportDayDisconnectDo) Omit(cols ...field.Expr) *reportDayDisconnectDo {
  185. return r.withDO(r.DO.Omit(cols...))
  186. }
  187. func (r reportDayDisconnectDo) Join(table schema.Tabler, on ...field.Expr) *reportDayDisconnectDo {
  188. return r.withDO(r.DO.Join(table, on...))
  189. }
  190. func (r reportDayDisconnectDo) LeftJoin(table schema.Tabler, on ...field.Expr) *reportDayDisconnectDo {
  191. return r.withDO(r.DO.LeftJoin(table, on...))
  192. }
  193. func (r reportDayDisconnectDo) RightJoin(table schema.Tabler, on ...field.Expr) *reportDayDisconnectDo {
  194. return r.withDO(r.DO.RightJoin(table, on...))
  195. }
  196. func (r reportDayDisconnectDo) Group(cols ...field.Expr) *reportDayDisconnectDo {
  197. return r.withDO(r.DO.Group(cols...))
  198. }
  199. func (r reportDayDisconnectDo) Having(conds ...gen.Condition) *reportDayDisconnectDo {
  200. return r.withDO(r.DO.Having(conds...))
  201. }
  202. func (r reportDayDisconnectDo) Limit(limit int) *reportDayDisconnectDo {
  203. return r.withDO(r.DO.Limit(limit))
  204. }
  205. func (r reportDayDisconnectDo) Offset(offset int) *reportDayDisconnectDo {
  206. return r.withDO(r.DO.Offset(offset))
  207. }
  208. func (r reportDayDisconnectDo) Scopes(funcs ...func(gen.Dao) gen.Dao) *reportDayDisconnectDo {
  209. return r.withDO(r.DO.Scopes(funcs...))
  210. }
  211. func (r reportDayDisconnectDo) Unscoped() *reportDayDisconnectDo {
  212. return r.withDO(r.DO.Unscoped())
  213. }
  214. func (r reportDayDisconnectDo) Create(values ...*model.ReportDayDisconnect) error {
  215. if len(values) == 0 {
  216. return nil
  217. }
  218. return r.DO.Create(values)
  219. }
  220. func (r reportDayDisconnectDo) CreateInBatches(values []*model.ReportDayDisconnect, batchSize int) error {
  221. return r.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 (r reportDayDisconnectDo) Save(values ...*model.ReportDayDisconnect) error {
  226. if len(values) == 0 {
  227. return nil
  228. }
  229. return r.DO.Save(values)
  230. }
  231. func (r reportDayDisconnectDo) First() (*model.ReportDayDisconnect, error) {
  232. if result, err := r.DO.First(); err != nil {
  233. return nil, err
  234. } else {
  235. return result.(*model.ReportDayDisconnect), nil
  236. }
  237. }
  238. func (r reportDayDisconnectDo) Take() (*model.ReportDayDisconnect, error) {
  239. if result, err := r.DO.Take(); err != nil {
  240. return nil, err
  241. } else {
  242. return result.(*model.ReportDayDisconnect), nil
  243. }
  244. }
  245. func (r reportDayDisconnectDo) Last() (*model.ReportDayDisconnect, error) {
  246. if result, err := r.DO.Last(); err != nil {
  247. return nil, err
  248. } else {
  249. return result.(*model.ReportDayDisconnect), nil
  250. }
  251. }
  252. func (r reportDayDisconnectDo) Find() ([]*model.ReportDayDisconnect, error) {
  253. result, err := r.DO.Find()
  254. return result.([]*model.ReportDayDisconnect), err
  255. }
  256. func (r reportDayDisconnectDo) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*model.ReportDayDisconnect, err error) {
  257. buf := make([]*model.ReportDayDisconnect, 0, batchSize)
  258. err = r.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 (r reportDayDisconnectDo) FindInBatches(result *[]*model.ReportDayDisconnect, batchSize int, fc func(tx gen.Dao, batch int) error) error {
  265. return r.DO.FindInBatches(result, batchSize, fc)
  266. }
  267. func (r reportDayDisconnectDo) Attrs(attrs ...field.AssignExpr) *reportDayDisconnectDo {
  268. return r.withDO(r.DO.Attrs(attrs...))
  269. }
  270. func (r reportDayDisconnectDo) Assign(attrs ...field.AssignExpr) *reportDayDisconnectDo {
  271. return r.withDO(r.DO.Assign(attrs...))
  272. }
  273. func (r reportDayDisconnectDo) Joins(fields ...field.RelationField) *reportDayDisconnectDo {
  274. for _, _f := range fields {
  275. r = *r.withDO(r.DO.Joins(_f))
  276. }
  277. return &r
  278. }
  279. func (r reportDayDisconnectDo) Preload(fields ...field.RelationField) *reportDayDisconnectDo {
  280. for _, _f := range fields {
  281. r = *r.withDO(r.DO.Preload(_f))
  282. }
  283. return &r
  284. }
  285. func (r reportDayDisconnectDo) FirstOrInit() (*model.ReportDayDisconnect, error) {
  286. if result, err := r.DO.FirstOrInit(); err != nil {
  287. return nil, err
  288. } else {
  289. return result.(*model.ReportDayDisconnect), nil
  290. }
  291. }
  292. func (r reportDayDisconnectDo) FirstOrCreate() (*model.ReportDayDisconnect, error) {
  293. if result, err := r.DO.FirstOrCreate(); err != nil {
  294. return nil, err
  295. } else {
  296. return result.(*model.ReportDayDisconnect), nil
  297. }
  298. }
  299. func (r reportDayDisconnectDo) FindByPage(offset int, limit int) (result []*model.ReportDayDisconnect, count int64, err error) {
  300. result, err = r.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 = r.Offset(-1).Limit(-1).Count()
  309. return
  310. }
  311. func (r reportDayDisconnectDo) ScanByPage(result interface{}, offset int, limit int) (count int64, err error) {
  312. count, err = r.Count()
  313. if err != nil {
  314. return
  315. }
  316. err = r.Offset(offset).Limit(limit).Scan(result)
  317. return
  318. }
  319. func (r reportDayDisconnectDo) Scan(result interface{}) (err error) {
  320. return r.DO.Scan(result)
  321. }
  322. func (r reportDayDisconnectDo) Delete(models ...*model.ReportDayDisconnect) (result gen.ResultInfo, err error) {
  323. return r.DO.Delete(models)
  324. }
  325. func (r *reportDayDisconnectDo) withDO(do gen.Dao) *reportDayDisconnectDo {
  326. r.DO = *do.(*gen.DO)
  327. return r
  328. }