batch_msg_copy1.gen.go 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433
  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. "wechat-api/database/dao/wechat/model"
  14. )
  15. func newBatchMsgCopy1(db *gorm.DB, opts ...gen.DOOption) batchMsgCopy1 {
  16. _batchMsgCopy1 := batchMsgCopy1{}
  17. _batchMsgCopy1.batchMsgCopy1Do.UseDB(db, opts...)
  18. _batchMsgCopy1.batchMsgCopy1Do.UseModel(&model.BatchMsgCopy1{})
  19. tableName := _batchMsgCopy1.batchMsgCopy1Do.TableName()
  20. _batchMsgCopy1.ALL = field.NewAsterisk(tableName)
  21. _batchMsgCopy1.ID = field.NewInt64(tableName, "id")
  22. _batchMsgCopy1.CreatedAt = field.NewTime(tableName, "created_at")
  23. _batchMsgCopy1.UpdatedAt = field.NewTime(tableName, "updated_at")
  24. _batchMsgCopy1.DeletedAt = field.NewField(tableName, "deleted_at")
  25. _batchMsgCopy1.Status = field.NewInt64(tableName, "status")
  26. _batchMsgCopy1.BatchNo = field.NewString(tableName, "batch_no")
  27. _batchMsgCopy1.Fromwxid = field.NewString(tableName, "fromwxid")
  28. _batchMsgCopy1.Msg = field.NewString(tableName, "msg")
  29. _batchMsgCopy1.Tag = field.NewString(tableName, "tag")
  30. _batchMsgCopy1.Total = field.NewInt64(tableName, "total")
  31. _batchMsgCopy1.Success = field.NewInt64(tableName, "success")
  32. _batchMsgCopy1.Fail = field.NewInt64(tableName, "fail")
  33. _batchMsgCopy1.StartTime = field.NewTime(tableName, "start_time")
  34. _batchMsgCopy1.StopTime = field.NewTime(tableName, "stop_time")
  35. _batchMsgCopy1.fillFieldMap()
  36. return _batchMsgCopy1
  37. }
  38. // batchMsgCopy1 批量消息表
  39. type batchMsgCopy1 struct {
  40. batchMsgCopy1Do
  41. ALL field.Asterisk
  42. ID field.Int64
  43. CreatedAt field.Time // Create Time | 创建日期
  44. UpdatedAt field.Time // Update Time | 修改日期
  45. DeletedAt field.Field // Delete Time | 删除日期
  46. Status field.Int64 // 状态 0 未开始 1 发送中 2 发送完成 3 发送中止
  47. BatchNo field.String // 批次号
  48. Fromwxid field.String // 发送方微信ID
  49. Msg field.String // 内容
  50. Tag field.String // 发送规则 all 全部 tag1,tag2 按tag发送
  51. Total field.Int64 // 总数
  52. Success field.Int64 // 成功数量
  53. Fail field.Int64 // 失败数量
  54. StartTime field.Time // 开始时间
  55. StopTime field.Time // 结束时间
  56. fieldMap map[string]field.Expr
  57. }
  58. func (b batchMsgCopy1) Table(newTableName string) *batchMsgCopy1 {
  59. b.batchMsgCopy1Do.UseTable(newTableName)
  60. return b.updateTableName(newTableName)
  61. }
  62. func (b batchMsgCopy1) As(alias string) *batchMsgCopy1 {
  63. b.batchMsgCopy1Do.DO = *(b.batchMsgCopy1Do.As(alias).(*gen.DO))
  64. return b.updateTableName(alias)
  65. }
  66. func (b *batchMsgCopy1) updateTableName(table string) *batchMsgCopy1 {
  67. b.ALL = field.NewAsterisk(table)
  68. b.ID = field.NewInt64(table, "id")
  69. b.CreatedAt = field.NewTime(table, "created_at")
  70. b.UpdatedAt = field.NewTime(table, "updated_at")
  71. b.DeletedAt = field.NewField(table, "deleted_at")
  72. b.Status = field.NewInt64(table, "status")
  73. b.BatchNo = field.NewString(table, "batch_no")
  74. b.Fromwxid = field.NewString(table, "fromwxid")
  75. b.Msg = field.NewString(table, "msg")
  76. b.Tag = field.NewString(table, "tag")
  77. b.Total = field.NewInt64(table, "total")
  78. b.Success = field.NewInt64(table, "success")
  79. b.Fail = field.NewInt64(table, "fail")
  80. b.StartTime = field.NewTime(table, "start_time")
  81. b.StopTime = field.NewTime(table, "stop_time")
  82. b.fillFieldMap()
  83. return b
  84. }
  85. func (b *batchMsgCopy1) GetFieldByName(fieldName string) (field.OrderExpr, bool) {
  86. _f, ok := b.fieldMap[fieldName]
  87. if !ok || _f == nil {
  88. return nil, false
  89. }
  90. _oe, ok := _f.(field.OrderExpr)
  91. return _oe, ok
  92. }
  93. func (b *batchMsgCopy1) fillFieldMap() {
  94. b.fieldMap = make(map[string]field.Expr, 14)
  95. b.fieldMap["id"] = b.ID
  96. b.fieldMap["created_at"] = b.CreatedAt
  97. b.fieldMap["updated_at"] = b.UpdatedAt
  98. b.fieldMap["deleted_at"] = b.DeletedAt
  99. b.fieldMap["status"] = b.Status
  100. b.fieldMap["batch_no"] = b.BatchNo
  101. b.fieldMap["fromwxid"] = b.Fromwxid
  102. b.fieldMap["msg"] = b.Msg
  103. b.fieldMap["tag"] = b.Tag
  104. b.fieldMap["total"] = b.Total
  105. b.fieldMap["success"] = b.Success
  106. b.fieldMap["fail"] = b.Fail
  107. b.fieldMap["start_time"] = b.StartTime
  108. b.fieldMap["stop_time"] = b.StopTime
  109. }
  110. func (b batchMsgCopy1) clone(db *gorm.DB) batchMsgCopy1 {
  111. b.batchMsgCopy1Do.ReplaceConnPool(db.Statement.ConnPool)
  112. return b
  113. }
  114. func (b batchMsgCopy1) replaceDB(db *gorm.DB) batchMsgCopy1 {
  115. b.batchMsgCopy1Do.ReplaceDB(db)
  116. return b
  117. }
  118. type batchMsgCopy1Do struct{ gen.DO }
  119. type IBatchMsgCopy1Do interface {
  120. gen.SubQuery
  121. Debug() IBatchMsgCopy1Do
  122. WithContext(ctx context.Context) IBatchMsgCopy1Do
  123. WithResult(fc func(tx gen.Dao)) gen.ResultInfo
  124. ReplaceDB(db *gorm.DB)
  125. ReadDB() IBatchMsgCopy1Do
  126. WriteDB() IBatchMsgCopy1Do
  127. As(alias string) gen.Dao
  128. Session(config *gorm.Session) IBatchMsgCopy1Do
  129. Columns(cols ...field.Expr) gen.Columns
  130. Clauses(conds ...clause.Expression) IBatchMsgCopy1Do
  131. Not(conds ...gen.Condition) IBatchMsgCopy1Do
  132. Or(conds ...gen.Condition) IBatchMsgCopy1Do
  133. Select(conds ...field.Expr) IBatchMsgCopy1Do
  134. Where(conds ...gen.Condition) IBatchMsgCopy1Do
  135. Order(conds ...field.Expr) IBatchMsgCopy1Do
  136. Distinct(cols ...field.Expr) IBatchMsgCopy1Do
  137. Omit(cols ...field.Expr) IBatchMsgCopy1Do
  138. Join(table schema.Tabler, on ...field.Expr) IBatchMsgCopy1Do
  139. LeftJoin(table schema.Tabler, on ...field.Expr) IBatchMsgCopy1Do
  140. RightJoin(table schema.Tabler, on ...field.Expr) IBatchMsgCopy1Do
  141. Group(cols ...field.Expr) IBatchMsgCopy1Do
  142. Having(conds ...gen.Condition) IBatchMsgCopy1Do
  143. Limit(limit int) IBatchMsgCopy1Do
  144. Offset(offset int) IBatchMsgCopy1Do
  145. Count() (count int64, err error)
  146. Scopes(funcs ...func(gen.Dao) gen.Dao) IBatchMsgCopy1Do
  147. Unscoped() IBatchMsgCopy1Do
  148. Create(values ...*model.BatchMsgCopy1) error
  149. CreateInBatches(values []*model.BatchMsgCopy1, batchSize int) error
  150. Save(values ...*model.BatchMsgCopy1) error
  151. First() (*model.BatchMsgCopy1, error)
  152. Take() (*model.BatchMsgCopy1, error)
  153. Last() (*model.BatchMsgCopy1, error)
  154. Find() ([]*model.BatchMsgCopy1, error)
  155. FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*model.BatchMsgCopy1, err error)
  156. FindInBatches(result *[]*model.BatchMsgCopy1, batchSize int, fc func(tx gen.Dao, batch int) error) error
  157. Pluck(column field.Expr, dest interface{}) error
  158. Delete(...*model.BatchMsgCopy1) (info gen.ResultInfo, err error)
  159. Update(column field.Expr, value interface{}) (info gen.ResultInfo, err error)
  160. UpdateSimple(columns ...field.AssignExpr) (info gen.ResultInfo, err error)
  161. Updates(value interface{}) (info gen.ResultInfo, err error)
  162. UpdateColumn(column field.Expr, value interface{}) (info gen.ResultInfo, err error)
  163. UpdateColumnSimple(columns ...field.AssignExpr) (info gen.ResultInfo, err error)
  164. UpdateColumns(value interface{}) (info gen.ResultInfo, err error)
  165. UpdateFrom(q gen.SubQuery) gen.Dao
  166. Attrs(attrs ...field.AssignExpr) IBatchMsgCopy1Do
  167. Assign(attrs ...field.AssignExpr) IBatchMsgCopy1Do
  168. Joins(fields ...field.RelationField) IBatchMsgCopy1Do
  169. Preload(fields ...field.RelationField) IBatchMsgCopy1Do
  170. FirstOrInit() (*model.BatchMsgCopy1, error)
  171. FirstOrCreate() (*model.BatchMsgCopy1, error)
  172. FindByPage(offset int, limit int) (result []*model.BatchMsgCopy1, count int64, err error)
  173. ScanByPage(result interface{}, offset int, limit int) (count int64, err error)
  174. Scan(result interface{}) (err error)
  175. Returning(value interface{}, columns ...string) IBatchMsgCopy1Do
  176. UnderlyingDB() *gorm.DB
  177. schema.Tabler
  178. }
  179. func (b batchMsgCopy1Do) Debug() IBatchMsgCopy1Do {
  180. return b.withDO(b.DO.Debug())
  181. }
  182. func (b batchMsgCopy1Do) WithContext(ctx context.Context) IBatchMsgCopy1Do {
  183. return b.withDO(b.DO.WithContext(ctx))
  184. }
  185. func (b batchMsgCopy1Do) ReadDB() IBatchMsgCopy1Do {
  186. return b.Clauses(dbresolver.Read)
  187. }
  188. func (b batchMsgCopy1Do) WriteDB() IBatchMsgCopy1Do {
  189. return b.Clauses(dbresolver.Write)
  190. }
  191. func (b batchMsgCopy1Do) Session(config *gorm.Session) IBatchMsgCopy1Do {
  192. return b.withDO(b.DO.Session(config))
  193. }
  194. func (b batchMsgCopy1Do) Clauses(conds ...clause.Expression) IBatchMsgCopy1Do {
  195. return b.withDO(b.DO.Clauses(conds...))
  196. }
  197. func (b batchMsgCopy1Do) Returning(value interface{}, columns ...string) IBatchMsgCopy1Do {
  198. return b.withDO(b.DO.Returning(value, columns...))
  199. }
  200. func (b batchMsgCopy1Do) Not(conds ...gen.Condition) IBatchMsgCopy1Do {
  201. return b.withDO(b.DO.Not(conds...))
  202. }
  203. func (b batchMsgCopy1Do) Or(conds ...gen.Condition) IBatchMsgCopy1Do {
  204. return b.withDO(b.DO.Or(conds...))
  205. }
  206. func (b batchMsgCopy1Do) Select(conds ...field.Expr) IBatchMsgCopy1Do {
  207. return b.withDO(b.DO.Select(conds...))
  208. }
  209. func (b batchMsgCopy1Do) Where(conds ...gen.Condition) IBatchMsgCopy1Do {
  210. return b.withDO(b.DO.Where(conds...))
  211. }
  212. func (b batchMsgCopy1Do) Order(conds ...field.Expr) IBatchMsgCopy1Do {
  213. return b.withDO(b.DO.Order(conds...))
  214. }
  215. func (b batchMsgCopy1Do) Distinct(cols ...field.Expr) IBatchMsgCopy1Do {
  216. return b.withDO(b.DO.Distinct(cols...))
  217. }
  218. func (b batchMsgCopy1Do) Omit(cols ...field.Expr) IBatchMsgCopy1Do {
  219. return b.withDO(b.DO.Omit(cols...))
  220. }
  221. func (b batchMsgCopy1Do) Join(table schema.Tabler, on ...field.Expr) IBatchMsgCopy1Do {
  222. return b.withDO(b.DO.Join(table, on...))
  223. }
  224. func (b batchMsgCopy1Do) LeftJoin(table schema.Tabler, on ...field.Expr) IBatchMsgCopy1Do {
  225. return b.withDO(b.DO.LeftJoin(table, on...))
  226. }
  227. func (b batchMsgCopy1Do) RightJoin(table schema.Tabler, on ...field.Expr) IBatchMsgCopy1Do {
  228. return b.withDO(b.DO.RightJoin(table, on...))
  229. }
  230. func (b batchMsgCopy1Do) Group(cols ...field.Expr) IBatchMsgCopy1Do {
  231. return b.withDO(b.DO.Group(cols...))
  232. }
  233. func (b batchMsgCopy1Do) Having(conds ...gen.Condition) IBatchMsgCopy1Do {
  234. return b.withDO(b.DO.Having(conds...))
  235. }
  236. func (b batchMsgCopy1Do) Limit(limit int) IBatchMsgCopy1Do {
  237. return b.withDO(b.DO.Limit(limit))
  238. }
  239. func (b batchMsgCopy1Do) Offset(offset int) IBatchMsgCopy1Do {
  240. return b.withDO(b.DO.Offset(offset))
  241. }
  242. func (b batchMsgCopy1Do) Scopes(funcs ...func(gen.Dao) gen.Dao) IBatchMsgCopy1Do {
  243. return b.withDO(b.DO.Scopes(funcs...))
  244. }
  245. func (b batchMsgCopy1Do) Unscoped() IBatchMsgCopy1Do {
  246. return b.withDO(b.DO.Unscoped())
  247. }
  248. func (b batchMsgCopy1Do) Create(values ...*model.BatchMsgCopy1) error {
  249. if len(values) == 0 {
  250. return nil
  251. }
  252. return b.DO.Create(values)
  253. }
  254. func (b batchMsgCopy1Do) CreateInBatches(values []*model.BatchMsgCopy1, batchSize int) error {
  255. return b.DO.CreateInBatches(values, batchSize)
  256. }
  257. // Save : !!! underlying implementation is different with GORM
  258. // The method is equivalent to executing the statement: db.Clauses(clause.OnConflict{UpdateAll: true}).Create(values)
  259. func (b batchMsgCopy1Do) Save(values ...*model.BatchMsgCopy1) error {
  260. if len(values) == 0 {
  261. return nil
  262. }
  263. return b.DO.Save(values)
  264. }
  265. func (b batchMsgCopy1Do) First() (*model.BatchMsgCopy1, error) {
  266. if result, err := b.DO.First(); err != nil {
  267. return nil, err
  268. } else {
  269. return result.(*model.BatchMsgCopy1), nil
  270. }
  271. }
  272. func (b batchMsgCopy1Do) Take() (*model.BatchMsgCopy1, error) {
  273. if result, err := b.DO.Take(); err != nil {
  274. return nil, err
  275. } else {
  276. return result.(*model.BatchMsgCopy1), nil
  277. }
  278. }
  279. func (b batchMsgCopy1Do) Last() (*model.BatchMsgCopy1, error) {
  280. if result, err := b.DO.Last(); err != nil {
  281. return nil, err
  282. } else {
  283. return result.(*model.BatchMsgCopy1), nil
  284. }
  285. }
  286. func (b batchMsgCopy1Do) Find() ([]*model.BatchMsgCopy1, error) {
  287. result, err := b.DO.Find()
  288. return result.([]*model.BatchMsgCopy1), err
  289. }
  290. func (b batchMsgCopy1Do) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*model.BatchMsgCopy1, err error) {
  291. buf := make([]*model.BatchMsgCopy1, 0, batchSize)
  292. err = b.DO.FindInBatches(&buf, batchSize, func(tx gen.Dao, batch int) error {
  293. defer func() { results = append(results, buf...) }()
  294. return fc(tx, batch)
  295. })
  296. return results, err
  297. }
  298. func (b batchMsgCopy1Do) FindInBatches(result *[]*model.BatchMsgCopy1, batchSize int, fc func(tx gen.Dao, batch int) error) error {
  299. return b.DO.FindInBatches(result, batchSize, fc)
  300. }
  301. func (b batchMsgCopy1Do) Attrs(attrs ...field.AssignExpr) IBatchMsgCopy1Do {
  302. return b.withDO(b.DO.Attrs(attrs...))
  303. }
  304. func (b batchMsgCopy1Do) Assign(attrs ...field.AssignExpr) IBatchMsgCopy1Do {
  305. return b.withDO(b.DO.Assign(attrs...))
  306. }
  307. func (b batchMsgCopy1Do) Joins(fields ...field.RelationField) IBatchMsgCopy1Do {
  308. for _, _f := range fields {
  309. b = *b.withDO(b.DO.Joins(_f))
  310. }
  311. return &b
  312. }
  313. func (b batchMsgCopy1Do) Preload(fields ...field.RelationField) IBatchMsgCopy1Do {
  314. for _, _f := range fields {
  315. b = *b.withDO(b.DO.Preload(_f))
  316. }
  317. return &b
  318. }
  319. func (b batchMsgCopy1Do) FirstOrInit() (*model.BatchMsgCopy1, error) {
  320. if result, err := b.DO.FirstOrInit(); err != nil {
  321. return nil, err
  322. } else {
  323. return result.(*model.BatchMsgCopy1), nil
  324. }
  325. }
  326. func (b batchMsgCopy1Do) FirstOrCreate() (*model.BatchMsgCopy1, error) {
  327. if result, err := b.DO.FirstOrCreate(); err != nil {
  328. return nil, err
  329. } else {
  330. return result.(*model.BatchMsgCopy1), nil
  331. }
  332. }
  333. func (b batchMsgCopy1Do) FindByPage(offset int, limit int) (result []*model.BatchMsgCopy1, count int64, err error) {
  334. result, err = b.Offset(offset).Limit(limit).Find()
  335. if err != nil {
  336. return
  337. }
  338. if size := len(result); 0 < limit && 0 < size && size < limit {
  339. count = int64(size + offset)
  340. return
  341. }
  342. count, err = b.Offset(-1).Limit(-1).Count()
  343. return
  344. }
  345. func (b batchMsgCopy1Do) ScanByPage(result interface{}, offset int, limit int) (count int64, err error) {
  346. count, err = b.Count()
  347. if err != nil {
  348. return
  349. }
  350. err = b.Offset(offset).Limit(limit).Scan(result)
  351. return
  352. }
  353. func (b batchMsgCopy1Do) Scan(result interface{}) (err error) {
  354. return b.DO.Scan(result)
  355. }
  356. func (b batchMsgCopy1Do) Delete(models ...*model.BatchMsgCopy1) (result gen.ResultInfo, err error) {
  357. return b.DO.Delete(models)
  358. }
  359. func (b *batchMsgCopy1Do) withDO(do gen.Dao) *batchMsgCopy1Do {
  360. b.DO = *do.(*gen.DO)
  361. return b
  362. }