report_day_gem.gen.go 11 KB

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