gen.go 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455
  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. "database/sql"
  8. "gorm.io/gorm"
  9. "gorm.io/gen"
  10. "gorm.io/plugin/dbresolver"
  11. )
  12. var (
  13. Q = new(Query)
  14. Agent *agent
  15. AliyunAvatar *aliyunAvatar
  16. AllocAgent *allocAgent
  17. BatchMsg *batchMsg
  18. BatchMsgCopy1 *batchMsgCopy1
  19. Category *category
  20. ChatRecord *chatRecord
  21. ChatSession *chatSession
  22. Contact *contact
  23. CreditBalance *creditBalance
  24. CreditUsage *creditUsage
  25. Employee *employee
  26. EmployeeConfig *employeeConfig
  27. FormRecord *formRecord
  28. IntentOrg *intentOrg
  29. IntentRecord *intentRecord
  30. Label *label
  31. LabelRelationship *labelRelationship
  32. LabelTagging *labelTagging
  33. MessageRecord *messageRecord
  34. MismatchRecord *mismatchRecord
  35. Msg *msg
  36. PayRecharge *payRecharge
  37. Record *record
  38. Server *server
  39. SopNode *sopNode
  40. SopStage *sopStage
  41. SopTask *sopTask
  42. Token *token
  43. Tutorial *tutorial
  44. UsageDetail *usageDetail
  45. UsageStatisticDay *usageStatisticDay
  46. UsageStatisticHour *usageStatisticHour
  47. UsageStatisticMonth *usageStatisticMonth
  48. UsageTotal *usageTotal
  49. Whatsapp *whatsapp
  50. WhatsappChannel *whatsappChannel
  51. WorkExperience *workExperience
  52. WpChatroom *wpChatroom
  53. WpChatroomMember *wpChatroomMember
  54. Wx *wx
  55. WxCard *wxCard
  56. WxCardUser *wxCardUser
  57. WxCardVisit *wxCardVisit
  58. XunjiContact *xunjiContact
  59. )
  60. func SetDefault(db *gorm.DB, opts ...gen.DOOption) {
  61. *Q = *Use(db, opts...)
  62. Agent = &Q.Agent
  63. AliyunAvatar = &Q.AliyunAvatar
  64. AllocAgent = &Q.AllocAgent
  65. BatchMsg = &Q.BatchMsg
  66. BatchMsgCopy1 = &Q.BatchMsgCopy1
  67. Category = &Q.Category
  68. ChatRecord = &Q.ChatRecord
  69. ChatSession = &Q.ChatSession
  70. Contact = &Q.Contact
  71. CreditBalance = &Q.CreditBalance
  72. CreditUsage = &Q.CreditUsage
  73. Employee = &Q.Employee
  74. EmployeeConfig = &Q.EmployeeConfig
  75. FormRecord = &Q.FormRecord
  76. IntentOrg = &Q.IntentOrg
  77. IntentRecord = &Q.IntentRecord
  78. Label = &Q.Label
  79. LabelRelationship = &Q.LabelRelationship
  80. LabelTagging = &Q.LabelTagging
  81. MessageRecord = &Q.MessageRecord
  82. MismatchRecord = &Q.MismatchRecord
  83. Msg = &Q.Msg
  84. PayRecharge = &Q.PayRecharge
  85. Record = &Q.Record
  86. Server = &Q.Server
  87. SopNode = &Q.SopNode
  88. SopStage = &Q.SopStage
  89. SopTask = &Q.SopTask
  90. Token = &Q.Token
  91. Tutorial = &Q.Tutorial
  92. UsageDetail = &Q.UsageDetail
  93. UsageStatisticDay = &Q.UsageStatisticDay
  94. UsageStatisticHour = &Q.UsageStatisticHour
  95. UsageStatisticMonth = &Q.UsageStatisticMonth
  96. UsageTotal = &Q.UsageTotal
  97. Whatsapp = &Q.Whatsapp
  98. WhatsappChannel = &Q.WhatsappChannel
  99. WorkExperience = &Q.WorkExperience
  100. WpChatroom = &Q.WpChatroom
  101. WpChatroomMember = &Q.WpChatroomMember
  102. Wx = &Q.Wx
  103. WxCard = &Q.WxCard
  104. WxCardUser = &Q.WxCardUser
  105. WxCardVisit = &Q.WxCardVisit
  106. XunjiContact = &Q.XunjiContact
  107. }
  108. func Use(db *gorm.DB, opts ...gen.DOOption) *Query {
  109. return &Query{
  110. db: db,
  111. Agent: newAgent(db, opts...),
  112. AliyunAvatar: newAliyunAvatar(db, opts...),
  113. AllocAgent: newAllocAgent(db, opts...),
  114. BatchMsg: newBatchMsg(db, opts...),
  115. BatchMsgCopy1: newBatchMsgCopy1(db, opts...),
  116. Category: newCategory(db, opts...),
  117. ChatRecord: newChatRecord(db, opts...),
  118. ChatSession: newChatSession(db, opts...),
  119. Contact: newContact(db, opts...),
  120. CreditBalance: newCreditBalance(db, opts...),
  121. CreditUsage: newCreditUsage(db, opts...),
  122. Employee: newEmployee(db, opts...),
  123. EmployeeConfig: newEmployeeConfig(db, opts...),
  124. FormRecord: newFormRecord(db, opts...),
  125. IntentOrg: newIntentOrg(db, opts...),
  126. IntentRecord: newIntentRecord(db, opts...),
  127. Label: newLabel(db, opts...),
  128. LabelRelationship: newLabelRelationship(db, opts...),
  129. LabelTagging: newLabelTagging(db, opts...),
  130. MessageRecord: newMessageRecord(db, opts...),
  131. MismatchRecord: newMismatchRecord(db, opts...),
  132. Msg: newMsg(db, opts...),
  133. PayRecharge: newPayRecharge(db, opts...),
  134. Record: newRecord(db, opts...),
  135. Server: newServer(db, opts...),
  136. SopNode: newSopNode(db, opts...),
  137. SopStage: newSopStage(db, opts...),
  138. SopTask: newSopTask(db, opts...),
  139. Token: newToken(db, opts...),
  140. Tutorial: newTutorial(db, opts...),
  141. UsageDetail: newUsageDetail(db, opts...),
  142. UsageStatisticDay: newUsageStatisticDay(db, opts...),
  143. UsageStatisticHour: newUsageStatisticHour(db, opts...),
  144. UsageStatisticMonth: newUsageStatisticMonth(db, opts...),
  145. UsageTotal: newUsageTotal(db, opts...),
  146. Whatsapp: newWhatsapp(db, opts...),
  147. WhatsappChannel: newWhatsappChannel(db, opts...),
  148. WorkExperience: newWorkExperience(db, opts...),
  149. WpChatroom: newWpChatroom(db, opts...),
  150. WpChatroomMember: newWpChatroomMember(db, opts...),
  151. Wx: newWx(db, opts...),
  152. WxCard: newWxCard(db, opts...),
  153. WxCardUser: newWxCardUser(db, opts...),
  154. WxCardVisit: newWxCardVisit(db, opts...),
  155. XunjiContact: newXunjiContact(db, opts...),
  156. }
  157. }
  158. type Query struct {
  159. db *gorm.DB
  160. Agent agent
  161. AliyunAvatar aliyunAvatar
  162. AllocAgent allocAgent
  163. BatchMsg batchMsg
  164. BatchMsgCopy1 batchMsgCopy1
  165. Category category
  166. ChatRecord chatRecord
  167. ChatSession chatSession
  168. Contact contact
  169. CreditBalance creditBalance
  170. CreditUsage creditUsage
  171. Employee employee
  172. EmployeeConfig employeeConfig
  173. FormRecord formRecord
  174. IntentOrg intentOrg
  175. IntentRecord intentRecord
  176. Label label
  177. LabelRelationship labelRelationship
  178. LabelTagging labelTagging
  179. MessageRecord messageRecord
  180. MismatchRecord mismatchRecord
  181. Msg msg
  182. PayRecharge payRecharge
  183. Record record
  184. Server server
  185. SopNode sopNode
  186. SopStage sopStage
  187. SopTask sopTask
  188. Token token
  189. Tutorial tutorial
  190. UsageDetail usageDetail
  191. UsageStatisticDay usageStatisticDay
  192. UsageStatisticHour usageStatisticHour
  193. UsageStatisticMonth usageStatisticMonth
  194. UsageTotal usageTotal
  195. Whatsapp whatsapp
  196. WhatsappChannel whatsappChannel
  197. WorkExperience workExperience
  198. WpChatroom wpChatroom
  199. WpChatroomMember wpChatroomMember
  200. Wx wx
  201. WxCard wxCard
  202. WxCardUser wxCardUser
  203. WxCardVisit wxCardVisit
  204. XunjiContact xunjiContact
  205. }
  206. func (q *Query) Available() bool { return q.db != nil }
  207. func (q *Query) clone(db *gorm.DB) *Query {
  208. return &Query{
  209. db: db,
  210. Agent: q.Agent.clone(db),
  211. AliyunAvatar: q.AliyunAvatar.clone(db),
  212. AllocAgent: q.AllocAgent.clone(db),
  213. BatchMsg: q.BatchMsg.clone(db),
  214. BatchMsgCopy1: q.BatchMsgCopy1.clone(db),
  215. Category: q.Category.clone(db),
  216. ChatRecord: q.ChatRecord.clone(db),
  217. ChatSession: q.ChatSession.clone(db),
  218. Contact: q.Contact.clone(db),
  219. CreditBalance: q.CreditBalance.clone(db),
  220. CreditUsage: q.CreditUsage.clone(db),
  221. Employee: q.Employee.clone(db),
  222. EmployeeConfig: q.EmployeeConfig.clone(db),
  223. FormRecord: q.FormRecord.clone(db),
  224. IntentOrg: q.IntentOrg.clone(db),
  225. IntentRecord: q.IntentRecord.clone(db),
  226. Label: q.Label.clone(db),
  227. LabelRelationship: q.LabelRelationship.clone(db),
  228. LabelTagging: q.LabelTagging.clone(db),
  229. MessageRecord: q.MessageRecord.clone(db),
  230. MismatchRecord: q.MismatchRecord.clone(db),
  231. Msg: q.Msg.clone(db),
  232. PayRecharge: q.PayRecharge.clone(db),
  233. Record: q.Record.clone(db),
  234. Server: q.Server.clone(db),
  235. SopNode: q.SopNode.clone(db),
  236. SopStage: q.SopStage.clone(db),
  237. SopTask: q.SopTask.clone(db),
  238. Token: q.Token.clone(db),
  239. Tutorial: q.Tutorial.clone(db),
  240. UsageDetail: q.UsageDetail.clone(db),
  241. UsageStatisticDay: q.UsageStatisticDay.clone(db),
  242. UsageStatisticHour: q.UsageStatisticHour.clone(db),
  243. UsageStatisticMonth: q.UsageStatisticMonth.clone(db),
  244. UsageTotal: q.UsageTotal.clone(db),
  245. Whatsapp: q.Whatsapp.clone(db),
  246. WhatsappChannel: q.WhatsappChannel.clone(db),
  247. WorkExperience: q.WorkExperience.clone(db),
  248. WpChatroom: q.WpChatroom.clone(db),
  249. WpChatroomMember: q.WpChatroomMember.clone(db),
  250. Wx: q.Wx.clone(db),
  251. WxCard: q.WxCard.clone(db),
  252. WxCardUser: q.WxCardUser.clone(db),
  253. WxCardVisit: q.WxCardVisit.clone(db),
  254. XunjiContact: q.XunjiContact.clone(db),
  255. }
  256. }
  257. func (q *Query) ReadDB() *Query {
  258. return q.ReplaceDB(q.db.Clauses(dbresolver.Read))
  259. }
  260. func (q *Query) WriteDB() *Query {
  261. return q.ReplaceDB(q.db.Clauses(dbresolver.Write))
  262. }
  263. func (q *Query) ReplaceDB(db *gorm.DB) *Query {
  264. return &Query{
  265. db: db,
  266. Agent: q.Agent.replaceDB(db),
  267. AliyunAvatar: q.AliyunAvatar.replaceDB(db),
  268. AllocAgent: q.AllocAgent.replaceDB(db),
  269. BatchMsg: q.BatchMsg.replaceDB(db),
  270. BatchMsgCopy1: q.BatchMsgCopy1.replaceDB(db),
  271. Category: q.Category.replaceDB(db),
  272. ChatRecord: q.ChatRecord.replaceDB(db),
  273. ChatSession: q.ChatSession.replaceDB(db),
  274. Contact: q.Contact.replaceDB(db),
  275. CreditBalance: q.CreditBalance.replaceDB(db),
  276. CreditUsage: q.CreditUsage.replaceDB(db),
  277. Employee: q.Employee.replaceDB(db),
  278. EmployeeConfig: q.EmployeeConfig.replaceDB(db),
  279. FormRecord: q.FormRecord.replaceDB(db),
  280. IntentOrg: q.IntentOrg.replaceDB(db),
  281. IntentRecord: q.IntentRecord.replaceDB(db),
  282. Label: q.Label.replaceDB(db),
  283. LabelRelationship: q.LabelRelationship.replaceDB(db),
  284. LabelTagging: q.LabelTagging.replaceDB(db),
  285. MessageRecord: q.MessageRecord.replaceDB(db),
  286. MismatchRecord: q.MismatchRecord.replaceDB(db),
  287. Msg: q.Msg.replaceDB(db),
  288. PayRecharge: q.PayRecharge.replaceDB(db),
  289. Record: q.Record.replaceDB(db),
  290. Server: q.Server.replaceDB(db),
  291. SopNode: q.SopNode.replaceDB(db),
  292. SopStage: q.SopStage.replaceDB(db),
  293. SopTask: q.SopTask.replaceDB(db),
  294. Token: q.Token.replaceDB(db),
  295. Tutorial: q.Tutorial.replaceDB(db),
  296. UsageDetail: q.UsageDetail.replaceDB(db),
  297. UsageStatisticDay: q.UsageStatisticDay.replaceDB(db),
  298. UsageStatisticHour: q.UsageStatisticHour.replaceDB(db),
  299. UsageStatisticMonth: q.UsageStatisticMonth.replaceDB(db),
  300. UsageTotal: q.UsageTotal.replaceDB(db),
  301. Whatsapp: q.Whatsapp.replaceDB(db),
  302. WhatsappChannel: q.WhatsappChannel.replaceDB(db),
  303. WorkExperience: q.WorkExperience.replaceDB(db),
  304. WpChatroom: q.WpChatroom.replaceDB(db),
  305. WpChatroomMember: q.WpChatroomMember.replaceDB(db),
  306. Wx: q.Wx.replaceDB(db),
  307. WxCard: q.WxCard.replaceDB(db),
  308. WxCardUser: q.WxCardUser.replaceDB(db),
  309. WxCardVisit: q.WxCardVisit.replaceDB(db),
  310. XunjiContact: q.XunjiContact.replaceDB(db),
  311. }
  312. }
  313. type queryCtx struct {
  314. Agent IAgentDo
  315. AliyunAvatar IAliyunAvatarDo
  316. AllocAgent IAllocAgentDo
  317. BatchMsg IBatchMsgDo
  318. BatchMsgCopy1 IBatchMsgCopy1Do
  319. Category ICategoryDo
  320. ChatRecord IChatRecordDo
  321. ChatSession IChatSessionDo
  322. Contact IContactDo
  323. CreditBalance ICreditBalanceDo
  324. CreditUsage ICreditUsageDo
  325. Employee IEmployeeDo
  326. EmployeeConfig IEmployeeConfigDo
  327. FormRecord IFormRecordDo
  328. IntentOrg IIntentOrgDo
  329. IntentRecord IIntentRecordDo
  330. Label ILabelDo
  331. LabelRelationship ILabelRelationshipDo
  332. LabelTagging ILabelTaggingDo
  333. MessageRecord IMessageRecordDo
  334. MismatchRecord IMismatchRecordDo
  335. Msg IMsgDo
  336. PayRecharge IPayRechargeDo
  337. Record IRecordDo
  338. Server IServerDo
  339. SopNode ISopNodeDo
  340. SopStage ISopStageDo
  341. SopTask ISopTaskDo
  342. Token ITokenDo
  343. Tutorial ITutorialDo
  344. UsageDetail IUsageDetailDo
  345. UsageStatisticDay IUsageStatisticDayDo
  346. UsageStatisticHour IUsageStatisticHourDo
  347. UsageStatisticMonth IUsageStatisticMonthDo
  348. UsageTotal IUsageTotalDo
  349. Whatsapp IWhatsappDo
  350. WhatsappChannel IWhatsappChannelDo
  351. WorkExperience IWorkExperienceDo
  352. WpChatroom IWpChatroomDo
  353. WpChatroomMember IWpChatroomMemberDo
  354. Wx IWxDo
  355. WxCard IWxCardDo
  356. WxCardUser IWxCardUserDo
  357. WxCardVisit IWxCardVisitDo
  358. XunjiContact IXunjiContactDo
  359. }
  360. func (q *Query) WithContext(ctx context.Context) *queryCtx {
  361. return &queryCtx{
  362. Agent: q.Agent.WithContext(ctx),
  363. AliyunAvatar: q.AliyunAvatar.WithContext(ctx),
  364. AllocAgent: q.AllocAgent.WithContext(ctx),
  365. BatchMsg: q.BatchMsg.WithContext(ctx),
  366. BatchMsgCopy1: q.BatchMsgCopy1.WithContext(ctx),
  367. Category: q.Category.WithContext(ctx),
  368. ChatRecord: q.ChatRecord.WithContext(ctx),
  369. ChatSession: q.ChatSession.WithContext(ctx),
  370. Contact: q.Contact.WithContext(ctx),
  371. CreditBalance: q.CreditBalance.WithContext(ctx),
  372. CreditUsage: q.CreditUsage.WithContext(ctx),
  373. Employee: q.Employee.WithContext(ctx),
  374. EmployeeConfig: q.EmployeeConfig.WithContext(ctx),
  375. FormRecord: q.FormRecord.WithContext(ctx),
  376. IntentOrg: q.IntentOrg.WithContext(ctx),
  377. IntentRecord: q.IntentRecord.WithContext(ctx),
  378. Label: q.Label.WithContext(ctx),
  379. LabelRelationship: q.LabelRelationship.WithContext(ctx),
  380. LabelTagging: q.LabelTagging.WithContext(ctx),
  381. MessageRecord: q.MessageRecord.WithContext(ctx),
  382. MismatchRecord: q.MismatchRecord.WithContext(ctx),
  383. Msg: q.Msg.WithContext(ctx),
  384. PayRecharge: q.PayRecharge.WithContext(ctx),
  385. Record: q.Record.WithContext(ctx),
  386. Server: q.Server.WithContext(ctx),
  387. SopNode: q.SopNode.WithContext(ctx),
  388. SopStage: q.SopStage.WithContext(ctx),
  389. SopTask: q.SopTask.WithContext(ctx),
  390. Token: q.Token.WithContext(ctx),
  391. Tutorial: q.Tutorial.WithContext(ctx),
  392. UsageDetail: q.UsageDetail.WithContext(ctx),
  393. UsageStatisticDay: q.UsageStatisticDay.WithContext(ctx),
  394. UsageStatisticHour: q.UsageStatisticHour.WithContext(ctx),
  395. UsageStatisticMonth: q.UsageStatisticMonth.WithContext(ctx),
  396. UsageTotal: q.UsageTotal.WithContext(ctx),
  397. Whatsapp: q.Whatsapp.WithContext(ctx),
  398. WhatsappChannel: q.WhatsappChannel.WithContext(ctx),
  399. WorkExperience: q.WorkExperience.WithContext(ctx),
  400. WpChatroom: q.WpChatroom.WithContext(ctx),
  401. WpChatroomMember: q.WpChatroomMember.WithContext(ctx),
  402. Wx: q.Wx.WithContext(ctx),
  403. WxCard: q.WxCard.WithContext(ctx),
  404. WxCardUser: q.WxCardUser.WithContext(ctx),
  405. WxCardVisit: q.WxCardVisit.WithContext(ctx),
  406. XunjiContact: q.XunjiContact.WithContext(ctx),
  407. }
  408. }
  409. func (q *Query) Transaction(fc func(tx *Query) error, opts ...*sql.TxOptions) error {
  410. return q.db.Transaction(func(tx *gorm.DB) error { return fc(q.clone(tx)) }, opts...)
  411. }
  412. func (q *Query) Begin(opts ...*sql.TxOptions) *QueryTx {
  413. tx := q.db.Begin(opts...)
  414. return &QueryTx{Query: q.clone(tx), Error: tx.Error}
  415. }
  416. type QueryTx struct {
  417. *Query
  418. Error error
  419. }
  420. func (q *QueryTx) Commit() error {
  421. return q.db.Commit().Error
  422. }
  423. func (q *QueryTx) Rollback() error {
  424. return q.db.Rollback().Error
  425. }
  426. func (q *QueryTx) SavePoint(name string) error {
  427. return q.db.SavePoint(name).Error
  428. }
  429. func (q *QueryTx) RollbackTo(name string) error {
  430. return q.db.RollbackTo(name).Error
  431. }