wxpay_player.gen.go 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407
  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 newWxpayPlayer(db *gorm.DB, opts ...gen.DOOption) wxpayPlayer {
  16. _wxpayPlayer := wxpayPlayer{}
  17. _wxpayPlayer.wxpayPlayerDo.UseDB(db, opts...)
  18. _wxpayPlayer.wxpayPlayerDo.UseModel(&model.WxpayPlayer{})
  19. tableName := _wxpayPlayer.wxpayPlayerDo.TableName()
  20. _wxpayPlayer.ALL = field.NewAsterisk(tableName)
  21. _wxpayPlayer.Playerid = field.NewInt64(tableName, "playerid")
  22. _wxpayPlayer.BuyStatis = field.NewString(tableName, "buyStatis")
  23. _wxpayPlayer.OrderBox = field.NewString(tableName, "orderBox")
  24. _wxpayPlayer.VipGoods = field.NewString(tableName, "vipGoods")
  25. _wxpayPlayer.DailyDiscount = field.NewString(tableName, "dailyDiscount")
  26. _wxpayPlayer.RoleGift = field.NewString(tableName, "roleGift")
  27. _wxpayPlayer.Invite = field.NewString(tableName, "invite")
  28. _wxpayPlayer.AccPay = field.NewString(tableName, "accPay")
  29. _wxpayPlayer.Balance = field.NewInt32(tableName, "balance")
  30. _wxpayPlayer.LuckDraw = field.NewString(tableName, "luckDraw")
  31. _wxpayPlayer.Growth = field.NewString(tableName, "growth")
  32. _wxpayPlayer.BoxKeyGift = field.NewString(tableName, "boxKeyGift")
  33. _wxpayPlayer.NewYearGift = field.NewString(tableName, "newYearGift")
  34. _wxpayPlayer.Fifteen = field.NewString(tableName, "fifteen")
  35. _wxpayPlayer.TombSweep = field.NewString(tableName, "tombSweep")
  36. _wxpayPlayer.Lady38 = field.NewString(tableName, "lady38")
  37. _wxpayPlayer.SpecialGift = field.NewString(tableName, "specialGift")
  38. _wxpayPlayer.RichMan = field.NewString(tableName, "richMan")
  39. _wxpayPlayer.DragonBoat = field.NewString(tableName, "dragonBoat")
  40. _wxpayPlayer.WeekendGift = field.NewString(tableName, "weekendGift")
  41. _wxpayPlayer.QiXiGift = field.NewString(tableName, "qiXiGift")
  42. _wxpayPlayer.MoonFestivalGift = field.NewString(tableName, "moonFestivalGift")
  43. _wxpayPlayer.fillFieldMap()
  44. return _wxpayPlayer
  45. }
  46. type wxpayPlayer struct {
  47. wxpayPlayerDo
  48. ALL field.Asterisk
  49. Playerid field.Int64
  50. BuyStatis field.String
  51. OrderBox field.String
  52. VipGoods field.String
  53. DailyDiscount field.String
  54. RoleGift field.String
  55. Invite field.String
  56. AccPay field.String
  57. Balance field.Int32
  58. LuckDraw field.String
  59. Growth field.String
  60. BoxKeyGift field.String
  61. NewYearGift field.String
  62. Fifteen field.String
  63. TombSweep field.String
  64. Lady38 field.String
  65. SpecialGift field.String
  66. RichMan field.String
  67. DragonBoat field.String
  68. WeekendGift field.String
  69. QiXiGift field.String
  70. MoonFestivalGift field.String
  71. fieldMap map[string]field.Expr
  72. }
  73. func (w wxpayPlayer) Table(newTableName string) *wxpayPlayer {
  74. w.wxpayPlayerDo.UseTable(newTableName)
  75. return w.updateTableName(newTableName)
  76. }
  77. func (w wxpayPlayer) As(alias string) *wxpayPlayer {
  78. w.wxpayPlayerDo.DO = *(w.wxpayPlayerDo.As(alias).(*gen.DO))
  79. return w.updateTableName(alias)
  80. }
  81. func (w *wxpayPlayer) updateTableName(table string) *wxpayPlayer {
  82. w.ALL = field.NewAsterisk(table)
  83. w.Playerid = field.NewInt64(table, "playerid")
  84. w.BuyStatis = field.NewString(table, "buyStatis")
  85. w.OrderBox = field.NewString(table, "orderBox")
  86. w.VipGoods = field.NewString(table, "vipGoods")
  87. w.DailyDiscount = field.NewString(table, "dailyDiscount")
  88. w.RoleGift = field.NewString(table, "roleGift")
  89. w.Invite = field.NewString(table, "invite")
  90. w.AccPay = field.NewString(table, "accPay")
  91. w.Balance = field.NewInt32(table, "balance")
  92. w.LuckDraw = field.NewString(table, "luckDraw")
  93. w.Growth = field.NewString(table, "growth")
  94. w.BoxKeyGift = field.NewString(table, "boxKeyGift")
  95. w.NewYearGift = field.NewString(table, "newYearGift")
  96. w.Fifteen = field.NewString(table, "fifteen")
  97. w.TombSweep = field.NewString(table, "tombSweep")
  98. w.Lady38 = field.NewString(table, "lady38")
  99. w.SpecialGift = field.NewString(table, "specialGift")
  100. w.RichMan = field.NewString(table, "richMan")
  101. w.DragonBoat = field.NewString(table, "dragonBoat")
  102. w.WeekendGift = field.NewString(table, "weekendGift")
  103. w.QiXiGift = field.NewString(table, "qiXiGift")
  104. w.MoonFestivalGift = field.NewString(table, "moonFestivalGift")
  105. w.fillFieldMap()
  106. return w
  107. }
  108. func (w *wxpayPlayer) GetFieldByName(fieldName string) (field.OrderExpr, bool) {
  109. _f, ok := w.fieldMap[fieldName]
  110. if !ok || _f == nil {
  111. return nil, false
  112. }
  113. _oe, ok := _f.(field.OrderExpr)
  114. return _oe, ok
  115. }
  116. func (w *wxpayPlayer) fillFieldMap() {
  117. w.fieldMap = make(map[string]field.Expr, 22)
  118. w.fieldMap["playerid"] = w.Playerid
  119. w.fieldMap["buyStatis"] = w.BuyStatis
  120. w.fieldMap["orderBox"] = w.OrderBox
  121. w.fieldMap["vipGoods"] = w.VipGoods
  122. w.fieldMap["dailyDiscount"] = w.DailyDiscount
  123. w.fieldMap["roleGift"] = w.RoleGift
  124. w.fieldMap["invite"] = w.Invite
  125. w.fieldMap["accPay"] = w.AccPay
  126. w.fieldMap["balance"] = w.Balance
  127. w.fieldMap["luckDraw"] = w.LuckDraw
  128. w.fieldMap["growth"] = w.Growth
  129. w.fieldMap["boxKeyGift"] = w.BoxKeyGift
  130. w.fieldMap["newYearGift"] = w.NewYearGift
  131. w.fieldMap["fifteen"] = w.Fifteen
  132. w.fieldMap["tombSweep"] = w.TombSweep
  133. w.fieldMap["lady38"] = w.Lady38
  134. w.fieldMap["specialGift"] = w.SpecialGift
  135. w.fieldMap["richMan"] = w.RichMan
  136. w.fieldMap["dragonBoat"] = w.DragonBoat
  137. w.fieldMap["weekendGift"] = w.WeekendGift
  138. w.fieldMap["qiXiGift"] = w.QiXiGift
  139. w.fieldMap["moonFestivalGift"] = w.MoonFestivalGift
  140. }
  141. func (w wxpayPlayer) clone(db *gorm.DB) wxpayPlayer {
  142. w.wxpayPlayerDo.ReplaceConnPool(db.Statement.ConnPool)
  143. return w
  144. }
  145. func (w wxpayPlayer) replaceDB(db *gorm.DB) wxpayPlayer {
  146. w.wxpayPlayerDo.ReplaceDB(db)
  147. return w
  148. }
  149. type wxpayPlayerDo struct{ gen.DO }
  150. func (w wxpayPlayerDo) Debug() *wxpayPlayerDo {
  151. return w.withDO(w.DO.Debug())
  152. }
  153. func (w wxpayPlayerDo) WithContext(ctx context.Context) *wxpayPlayerDo {
  154. return w.withDO(w.DO.WithContext(ctx))
  155. }
  156. func (w wxpayPlayerDo) ReadDB() *wxpayPlayerDo {
  157. return w.Clauses(dbresolver.Read)
  158. }
  159. func (w wxpayPlayerDo) WriteDB() *wxpayPlayerDo {
  160. return w.Clauses(dbresolver.Write)
  161. }
  162. func (w wxpayPlayerDo) Session(config *gorm.Session) *wxpayPlayerDo {
  163. return w.withDO(w.DO.Session(config))
  164. }
  165. func (w wxpayPlayerDo) Clauses(conds ...clause.Expression) *wxpayPlayerDo {
  166. return w.withDO(w.DO.Clauses(conds...))
  167. }
  168. func (w wxpayPlayerDo) Returning(value interface{}, columns ...string) *wxpayPlayerDo {
  169. return w.withDO(w.DO.Returning(value, columns...))
  170. }
  171. func (w wxpayPlayerDo) Not(conds ...gen.Condition) *wxpayPlayerDo {
  172. return w.withDO(w.DO.Not(conds...))
  173. }
  174. func (w wxpayPlayerDo) Or(conds ...gen.Condition) *wxpayPlayerDo {
  175. return w.withDO(w.DO.Or(conds...))
  176. }
  177. func (w wxpayPlayerDo) Select(conds ...field.Expr) *wxpayPlayerDo {
  178. return w.withDO(w.DO.Select(conds...))
  179. }
  180. func (w wxpayPlayerDo) Where(conds ...gen.Condition) *wxpayPlayerDo {
  181. return w.withDO(w.DO.Where(conds...))
  182. }
  183. func (w wxpayPlayerDo) Exists(subquery interface{ UnderlyingDB() *gorm.DB }) *wxpayPlayerDo {
  184. return w.Where(field.CompareSubQuery(field.ExistsOp, nil, subquery.UnderlyingDB()))
  185. }
  186. func (w wxpayPlayerDo) Order(conds ...field.Expr) *wxpayPlayerDo {
  187. return w.withDO(w.DO.Order(conds...))
  188. }
  189. func (w wxpayPlayerDo) Distinct(cols ...field.Expr) *wxpayPlayerDo {
  190. return w.withDO(w.DO.Distinct(cols...))
  191. }
  192. func (w wxpayPlayerDo) Omit(cols ...field.Expr) *wxpayPlayerDo {
  193. return w.withDO(w.DO.Omit(cols...))
  194. }
  195. func (w wxpayPlayerDo) Join(table schema.Tabler, on ...field.Expr) *wxpayPlayerDo {
  196. return w.withDO(w.DO.Join(table, on...))
  197. }
  198. func (w wxpayPlayerDo) LeftJoin(table schema.Tabler, on ...field.Expr) *wxpayPlayerDo {
  199. return w.withDO(w.DO.LeftJoin(table, on...))
  200. }
  201. func (w wxpayPlayerDo) RightJoin(table schema.Tabler, on ...field.Expr) *wxpayPlayerDo {
  202. return w.withDO(w.DO.RightJoin(table, on...))
  203. }
  204. func (w wxpayPlayerDo) Group(cols ...field.Expr) *wxpayPlayerDo {
  205. return w.withDO(w.DO.Group(cols...))
  206. }
  207. func (w wxpayPlayerDo) Having(conds ...gen.Condition) *wxpayPlayerDo {
  208. return w.withDO(w.DO.Having(conds...))
  209. }
  210. func (w wxpayPlayerDo) Limit(limit int) *wxpayPlayerDo {
  211. return w.withDO(w.DO.Limit(limit))
  212. }
  213. func (w wxpayPlayerDo) Offset(offset int) *wxpayPlayerDo {
  214. return w.withDO(w.DO.Offset(offset))
  215. }
  216. func (w wxpayPlayerDo) Scopes(funcs ...func(gen.Dao) gen.Dao) *wxpayPlayerDo {
  217. return w.withDO(w.DO.Scopes(funcs...))
  218. }
  219. func (w wxpayPlayerDo) Unscoped() *wxpayPlayerDo {
  220. return w.withDO(w.DO.Unscoped())
  221. }
  222. func (w wxpayPlayerDo) Create(values ...*model.WxpayPlayer) error {
  223. if len(values) == 0 {
  224. return nil
  225. }
  226. return w.DO.Create(values)
  227. }
  228. func (w wxpayPlayerDo) CreateInBatches(values []*model.WxpayPlayer, batchSize int) error {
  229. return w.DO.CreateInBatches(values, batchSize)
  230. }
  231. // Save : !!! underlying implementation is different with GORM
  232. // The method is equivalent to executing the statement: db.Clauses(clause.OnConflict{UpdateAll: true}).Create(values)
  233. func (w wxpayPlayerDo) Save(values ...*model.WxpayPlayer) error {
  234. if len(values) == 0 {
  235. return nil
  236. }
  237. return w.DO.Save(values)
  238. }
  239. func (w wxpayPlayerDo) First() (*model.WxpayPlayer, error) {
  240. if result, err := w.DO.First(); err != nil {
  241. return nil, err
  242. } else {
  243. return result.(*model.WxpayPlayer), nil
  244. }
  245. }
  246. func (w wxpayPlayerDo) Take() (*model.WxpayPlayer, error) {
  247. if result, err := w.DO.Take(); err != nil {
  248. return nil, err
  249. } else {
  250. return result.(*model.WxpayPlayer), nil
  251. }
  252. }
  253. func (w wxpayPlayerDo) Last() (*model.WxpayPlayer, error) {
  254. if result, err := w.DO.Last(); err != nil {
  255. return nil, err
  256. } else {
  257. return result.(*model.WxpayPlayer), nil
  258. }
  259. }
  260. func (w wxpayPlayerDo) Find() ([]*model.WxpayPlayer, error) {
  261. result, err := w.DO.Find()
  262. return result.([]*model.WxpayPlayer), err
  263. }
  264. func (w wxpayPlayerDo) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*model.WxpayPlayer, err error) {
  265. buf := make([]*model.WxpayPlayer, 0, batchSize)
  266. err = w.DO.FindInBatches(&buf, batchSize, func(tx gen.Dao, batch int) error {
  267. defer func() { results = append(results, buf...) }()
  268. return fc(tx, batch)
  269. })
  270. return results, err
  271. }
  272. func (w wxpayPlayerDo) FindInBatches(result *[]*model.WxpayPlayer, batchSize int, fc func(tx gen.Dao, batch int) error) error {
  273. return w.DO.FindInBatches(result, batchSize, fc)
  274. }
  275. func (w wxpayPlayerDo) Attrs(attrs ...field.AssignExpr) *wxpayPlayerDo {
  276. return w.withDO(w.DO.Attrs(attrs...))
  277. }
  278. func (w wxpayPlayerDo) Assign(attrs ...field.AssignExpr) *wxpayPlayerDo {
  279. return w.withDO(w.DO.Assign(attrs...))
  280. }
  281. func (w wxpayPlayerDo) Joins(fields ...field.RelationField) *wxpayPlayerDo {
  282. for _, _f := range fields {
  283. w = *w.withDO(w.DO.Joins(_f))
  284. }
  285. return &w
  286. }
  287. func (w wxpayPlayerDo) Preload(fields ...field.RelationField) *wxpayPlayerDo {
  288. for _, _f := range fields {
  289. w = *w.withDO(w.DO.Preload(_f))
  290. }
  291. return &w
  292. }
  293. func (w wxpayPlayerDo) FirstOrInit() (*model.WxpayPlayer, error) {
  294. if result, err := w.DO.FirstOrInit(); err != nil {
  295. return nil, err
  296. } else {
  297. return result.(*model.WxpayPlayer), nil
  298. }
  299. }
  300. func (w wxpayPlayerDo) FirstOrCreate() (*model.WxpayPlayer, error) {
  301. if result, err := w.DO.FirstOrCreate(); err != nil {
  302. return nil, err
  303. } else {
  304. return result.(*model.WxpayPlayer), nil
  305. }
  306. }
  307. func (w wxpayPlayerDo) FindByPage(offset int, limit int) (result []*model.WxpayPlayer, count int64, err error) {
  308. result, err = w.Offset(offset).Limit(limit).Find()
  309. if err != nil {
  310. return
  311. }
  312. if size := len(result); 0 < limit && 0 < size && size < limit {
  313. count = int64(size + offset)
  314. return
  315. }
  316. count, err = w.Offset(-1).Limit(-1).Count()
  317. return
  318. }
  319. func (w wxpayPlayerDo) ScanByPage(result interface{}, offset int, limit int) (count int64, err error) {
  320. count, err = w.Count()
  321. if err != nil {
  322. return
  323. }
  324. err = w.Offset(offset).Limit(limit).Scan(result)
  325. return
  326. }
  327. func (w wxpayPlayerDo) Scan(result interface{}) (err error) {
  328. return w.DO.Scan(result)
  329. }
  330. func (w wxpayPlayerDo) Delete(models ...*model.WxpayPlayer) (result gen.ResultInfo, err error) {
  331. return w.DO.Delete(models)
  332. }
  333. func (w *wxpayPlayerDo) withDO(do gen.Dao) *wxpayPlayerDo {
  334. w.DO = *do.(*gen.DO)
  335. return w
  336. }