intercept.go 43 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109
  1. // Code generated by ent, DO NOT EDIT.
  2. package intercept
  3. import (
  4. "context"
  5. "fmt"
  6. "wechat-api/ent"
  7. "wechat-api/ent/agent"
  8. "wechat-api/ent/agentbase"
  9. "wechat-api/ent/aliyunavatar"
  10. "wechat-api/ent/batchmsg"
  11. "wechat-api/ent/category"
  12. "wechat-api/ent/chatrecords"
  13. "wechat-api/ent/chatsession"
  14. "wechat-api/ent/contact"
  15. "wechat-api/ent/employee"
  16. "wechat-api/ent/employeeconfig"
  17. "wechat-api/ent/label"
  18. "wechat-api/ent/labelrelationship"
  19. "wechat-api/ent/message"
  20. "wechat-api/ent/messagerecords"
  21. "wechat-api/ent/msg"
  22. "wechat-api/ent/predicate"
  23. "wechat-api/ent/server"
  24. "wechat-api/ent/sopnode"
  25. "wechat-api/ent/sopstage"
  26. "wechat-api/ent/soptask"
  27. "wechat-api/ent/token"
  28. "wechat-api/ent/tutorial"
  29. "wechat-api/ent/usagedetail"
  30. "wechat-api/ent/usagestatisticday"
  31. "wechat-api/ent/usagestatistichour"
  32. "wechat-api/ent/usagestatisticmonth"
  33. "wechat-api/ent/usagetotal"
  34. "wechat-api/ent/workexperience"
  35. "wechat-api/ent/wpchatroom"
  36. "wechat-api/ent/wpchatroommember"
  37. "wechat-api/ent/wx"
  38. "wechat-api/ent/wxcard"
  39. "wechat-api/ent/wxcarduser"
  40. "wechat-api/ent/wxcardvisit"
  41. "entgo.io/ent/dialect/sql"
  42. )
  43. // The Query interface represents an operation that queries a graph.
  44. // By using this interface, users can write generic code that manipulates
  45. // query builders of different types.
  46. type Query interface {
  47. // Type returns the string representation of the query type.
  48. Type() string
  49. // Limit the number of records to be returned by this query.
  50. Limit(int)
  51. // Offset to start from.
  52. Offset(int)
  53. // Unique configures the query builder to filter duplicate records.
  54. Unique(bool)
  55. // Order specifies how the records should be ordered.
  56. Order(...func(*sql.Selector))
  57. // WhereP appends storage-level predicates to the query builder. Using this method, users
  58. // can use type-assertion to append predicates that do not depend on any generated package.
  59. WhereP(...func(*sql.Selector))
  60. }
  61. // The Func type is an adapter that allows ordinary functions to be used as interceptors.
  62. // Unlike traversal functions, interceptors are skipped during graph traversals. Note that the
  63. // implementation of Func is different from the one defined in entgo.io/ent.InterceptFunc.
  64. type Func func(context.Context, Query) error
  65. // Intercept calls f(ctx, q) and then applied the next Querier.
  66. func (f Func) Intercept(next ent.Querier) ent.Querier {
  67. return ent.QuerierFunc(func(ctx context.Context, q ent.Query) (ent.Value, error) {
  68. query, err := NewQuery(q)
  69. if err != nil {
  70. return nil, err
  71. }
  72. if err := f(ctx, query); err != nil {
  73. return nil, err
  74. }
  75. return next.Query(ctx, q)
  76. })
  77. }
  78. // The TraverseFunc type is an adapter to allow the use of ordinary function as Traverser.
  79. // If f is a function with the appropriate signature, TraverseFunc(f) is a Traverser that calls f.
  80. type TraverseFunc func(context.Context, Query) error
  81. // Intercept is a dummy implementation of Intercept that returns the next Querier in the pipeline.
  82. func (f TraverseFunc) Intercept(next ent.Querier) ent.Querier {
  83. return next
  84. }
  85. // Traverse calls f(ctx, q).
  86. func (f TraverseFunc) Traverse(ctx context.Context, q ent.Query) error {
  87. query, err := NewQuery(q)
  88. if err != nil {
  89. return err
  90. }
  91. return f(ctx, query)
  92. }
  93. // The AgentFunc type is an adapter to allow the use of ordinary function as a Querier.
  94. type AgentFunc func(context.Context, *ent.AgentQuery) (ent.Value, error)
  95. // Query calls f(ctx, q).
  96. func (f AgentFunc) Query(ctx context.Context, q ent.Query) (ent.Value, error) {
  97. if q, ok := q.(*ent.AgentQuery); ok {
  98. return f(ctx, q)
  99. }
  100. return nil, fmt.Errorf("unexpected query type %T. expect *ent.AgentQuery", q)
  101. }
  102. // The TraverseAgent type is an adapter to allow the use of ordinary function as Traverser.
  103. type TraverseAgent func(context.Context, *ent.AgentQuery) error
  104. // Intercept is a dummy implementation of Intercept that returns the next Querier in the pipeline.
  105. func (f TraverseAgent) Intercept(next ent.Querier) ent.Querier {
  106. return next
  107. }
  108. // Traverse calls f(ctx, q).
  109. func (f TraverseAgent) Traverse(ctx context.Context, q ent.Query) error {
  110. if q, ok := q.(*ent.AgentQuery); ok {
  111. return f(ctx, q)
  112. }
  113. return fmt.Errorf("unexpected query type %T. expect *ent.AgentQuery", q)
  114. }
  115. // The AgentBaseFunc type is an adapter to allow the use of ordinary function as a Querier.
  116. type AgentBaseFunc func(context.Context, *ent.AgentBaseQuery) (ent.Value, error)
  117. // Query calls f(ctx, q).
  118. func (f AgentBaseFunc) Query(ctx context.Context, q ent.Query) (ent.Value, error) {
  119. if q, ok := q.(*ent.AgentBaseQuery); ok {
  120. return f(ctx, q)
  121. }
  122. return nil, fmt.Errorf("unexpected query type %T. expect *ent.AgentBaseQuery", q)
  123. }
  124. // The TraverseAgentBase type is an adapter to allow the use of ordinary function as Traverser.
  125. type TraverseAgentBase func(context.Context, *ent.AgentBaseQuery) error
  126. // Intercept is a dummy implementation of Intercept that returns the next Querier in the pipeline.
  127. func (f TraverseAgentBase) Intercept(next ent.Querier) ent.Querier {
  128. return next
  129. }
  130. // Traverse calls f(ctx, q).
  131. func (f TraverseAgentBase) Traverse(ctx context.Context, q ent.Query) error {
  132. if q, ok := q.(*ent.AgentBaseQuery); ok {
  133. return f(ctx, q)
  134. }
  135. return fmt.Errorf("unexpected query type %T. expect *ent.AgentBaseQuery", q)
  136. }
  137. // The AliyunAvatarFunc type is an adapter to allow the use of ordinary function as a Querier.
  138. type AliyunAvatarFunc func(context.Context, *ent.AliyunAvatarQuery) (ent.Value, error)
  139. // Query calls f(ctx, q).
  140. func (f AliyunAvatarFunc) Query(ctx context.Context, q ent.Query) (ent.Value, error) {
  141. if q, ok := q.(*ent.AliyunAvatarQuery); ok {
  142. return f(ctx, q)
  143. }
  144. return nil, fmt.Errorf("unexpected query type %T. expect *ent.AliyunAvatarQuery", q)
  145. }
  146. // The TraverseAliyunAvatar type is an adapter to allow the use of ordinary function as Traverser.
  147. type TraverseAliyunAvatar func(context.Context, *ent.AliyunAvatarQuery) error
  148. // Intercept is a dummy implementation of Intercept that returns the next Querier in the pipeline.
  149. func (f TraverseAliyunAvatar) Intercept(next ent.Querier) ent.Querier {
  150. return next
  151. }
  152. // Traverse calls f(ctx, q).
  153. func (f TraverseAliyunAvatar) Traverse(ctx context.Context, q ent.Query) error {
  154. if q, ok := q.(*ent.AliyunAvatarQuery); ok {
  155. return f(ctx, q)
  156. }
  157. return fmt.Errorf("unexpected query type %T. expect *ent.AliyunAvatarQuery", q)
  158. }
  159. // The BatchMsgFunc type is an adapter to allow the use of ordinary function as a Querier.
  160. type BatchMsgFunc func(context.Context, *ent.BatchMsgQuery) (ent.Value, error)
  161. // Query calls f(ctx, q).
  162. func (f BatchMsgFunc) Query(ctx context.Context, q ent.Query) (ent.Value, error) {
  163. if q, ok := q.(*ent.BatchMsgQuery); ok {
  164. return f(ctx, q)
  165. }
  166. return nil, fmt.Errorf("unexpected query type %T. expect *ent.BatchMsgQuery", q)
  167. }
  168. // The TraverseBatchMsg type is an adapter to allow the use of ordinary function as Traverser.
  169. type TraverseBatchMsg func(context.Context, *ent.BatchMsgQuery) error
  170. // Intercept is a dummy implementation of Intercept that returns the next Querier in the pipeline.
  171. func (f TraverseBatchMsg) Intercept(next ent.Querier) ent.Querier {
  172. return next
  173. }
  174. // Traverse calls f(ctx, q).
  175. func (f TraverseBatchMsg) Traverse(ctx context.Context, q ent.Query) error {
  176. if q, ok := q.(*ent.BatchMsgQuery); ok {
  177. return f(ctx, q)
  178. }
  179. return fmt.Errorf("unexpected query type %T. expect *ent.BatchMsgQuery", q)
  180. }
  181. // The CategoryFunc type is an adapter to allow the use of ordinary function as a Querier.
  182. type CategoryFunc func(context.Context, *ent.CategoryQuery) (ent.Value, error)
  183. // Query calls f(ctx, q).
  184. func (f CategoryFunc) Query(ctx context.Context, q ent.Query) (ent.Value, error) {
  185. if q, ok := q.(*ent.CategoryQuery); ok {
  186. return f(ctx, q)
  187. }
  188. return nil, fmt.Errorf("unexpected query type %T. expect *ent.CategoryQuery", q)
  189. }
  190. // The TraverseCategory type is an adapter to allow the use of ordinary function as Traverser.
  191. type TraverseCategory func(context.Context, *ent.CategoryQuery) error
  192. // Intercept is a dummy implementation of Intercept that returns the next Querier in the pipeline.
  193. func (f TraverseCategory) Intercept(next ent.Querier) ent.Querier {
  194. return next
  195. }
  196. // Traverse calls f(ctx, q).
  197. func (f TraverseCategory) Traverse(ctx context.Context, q ent.Query) error {
  198. if q, ok := q.(*ent.CategoryQuery); ok {
  199. return f(ctx, q)
  200. }
  201. return fmt.Errorf("unexpected query type %T. expect *ent.CategoryQuery", q)
  202. }
  203. // The ChatRecordsFunc type is an adapter to allow the use of ordinary function as a Querier.
  204. type ChatRecordsFunc func(context.Context, *ent.ChatRecordsQuery) (ent.Value, error)
  205. // Query calls f(ctx, q).
  206. func (f ChatRecordsFunc) Query(ctx context.Context, q ent.Query) (ent.Value, error) {
  207. if q, ok := q.(*ent.ChatRecordsQuery); ok {
  208. return f(ctx, q)
  209. }
  210. return nil, fmt.Errorf("unexpected query type %T. expect *ent.ChatRecordsQuery", q)
  211. }
  212. // The TraverseChatRecords type is an adapter to allow the use of ordinary function as Traverser.
  213. type TraverseChatRecords func(context.Context, *ent.ChatRecordsQuery) error
  214. // Intercept is a dummy implementation of Intercept that returns the next Querier in the pipeline.
  215. func (f TraverseChatRecords) Intercept(next ent.Querier) ent.Querier {
  216. return next
  217. }
  218. // Traverse calls f(ctx, q).
  219. func (f TraverseChatRecords) Traverse(ctx context.Context, q ent.Query) error {
  220. if q, ok := q.(*ent.ChatRecordsQuery); ok {
  221. return f(ctx, q)
  222. }
  223. return fmt.Errorf("unexpected query type %T. expect *ent.ChatRecordsQuery", q)
  224. }
  225. // The ChatSessionFunc type is an adapter to allow the use of ordinary function as a Querier.
  226. type ChatSessionFunc func(context.Context, *ent.ChatSessionQuery) (ent.Value, error)
  227. // Query calls f(ctx, q).
  228. func (f ChatSessionFunc) Query(ctx context.Context, q ent.Query) (ent.Value, error) {
  229. if q, ok := q.(*ent.ChatSessionQuery); ok {
  230. return f(ctx, q)
  231. }
  232. return nil, fmt.Errorf("unexpected query type %T. expect *ent.ChatSessionQuery", q)
  233. }
  234. // The TraverseChatSession type is an adapter to allow the use of ordinary function as Traverser.
  235. type TraverseChatSession func(context.Context, *ent.ChatSessionQuery) error
  236. // Intercept is a dummy implementation of Intercept that returns the next Querier in the pipeline.
  237. func (f TraverseChatSession) Intercept(next ent.Querier) ent.Querier {
  238. return next
  239. }
  240. // Traverse calls f(ctx, q).
  241. func (f TraverseChatSession) Traverse(ctx context.Context, q ent.Query) error {
  242. if q, ok := q.(*ent.ChatSessionQuery); ok {
  243. return f(ctx, q)
  244. }
  245. return fmt.Errorf("unexpected query type %T. expect *ent.ChatSessionQuery", q)
  246. }
  247. // The ContactFunc type is an adapter to allow the use of ordinary function as a Querier.
  248. type ContactFunc func(context.Context, *ent.ContactQuery) (ent.Value, error)
  249. // Query calls f(ctx, q).
  250. func (f ContactFunc) Query(ctx context.Context, q ent.Query) (ent.Value, error) {
  251. if q, ok := q.(*ent.ContactQuery); ok {
  252. return f(ctx, q)
  253. }
  254. return nil, fmt.Errorf("unexpected query type %T. expect *ent.ContactQuery", q)
  255. }
  256. // The TraverseContact type is an adapter to allow the use of ordinary function as Traverser.
  257. type TraverseContact func(context.Context, *ent.ContactQuery) error
  258. // Intercept is a dummy implementation of Intercept that returns the next Querier in the pipeline.
  259. func (f TraverseContact) Intercept(next ent.Querier) ent.Querier {
  260. return next
  261. }
  262. // Traverse calls f(ctx, q).
  263. func (f TraverseContact) Traverse(ctx context.Context, q ent.Query) error {
  264. if q, ok := q.(*ent.ContactQuery); ok {
  265. return f(ctx, q)
  266. }
  267. return fmt.Errorf("unexpected query type %T. expect *ent.ContactQuery", q)
  268. }
  269. // The EmployeeFunc type is an adapter to allow the use of ordinary function as a Querier.
  270. type EmployeeFunc func(context.Context, *ent.EmployeeQuery) (ent.Value, error)
  271. // Query calls f(ctx, q).
  272. func (f EmployeeFunc) Query(ctx context.Context, q ent.Query) (ent.Value, error) {
  273. if q, ok := q.(*ent.EmployeeQuery); ok {
  274. return f(ctx, q)
  275. }
  276. return nil, fmt.Errorf("unexpected query type %T. expect *ent.EmployeeQuery", q)
  277. }
  278. // The TraverseEmployee type is an adapter to allow the use of ordinary function as Traverser.
  279. type TraverseEmployee func(context.Context, *ent.EmployeeQuery) error
  280. // Intercept is a dummy implementation of Intercept that returns the next Querier in the pipeline.
  281. func (f TraverseEmployee) Intercept(next ent.Querier) ent.Querier {
  282. return next
  283. }
  284. // Traverse calls f(ctx, q).
  285. func (f TraverseEmployee) Traverse(ctx context.Context, q ent.Query) error {
  286. if q, ok := q.(*ent.EmployeeQuery); ok {
  287. return f(ctx, q)
  288. }
  289. return fmt.Errorf("unexpected query type %T. expect *ent.EmployeeQuery", q)
  290. }
  291. // The EmployeeConfigFunc type is an adapter to allow the use of ordinary function as a Querier.
  292. type EmployeeConfigFunc func(context.Context, *ent.EmployeeConfigQuery) (ent.Value, error)
  293. // Query calls f(ctx, q).
  294. func (f EmployeeConfigFunc) Query(ctx context.Context, q ent.Query) (ent.Value, error) {
  295. if q, ok := q.(*ent.EmployeeConfigQuery); ok {
  296. return f(ctx, q)
  297. }
  298. return nil, fmt.Errorf("unexpected query type %T. expect *ent.EmployeeConfigQuery", q)
  299. }
  300. // The TraverseEmployeeConfig type is an adapter to allow the use of ordinary function as Traverser.
  301. type TraverseEmployeeConfig func(context.Context, *ent.EmployeeConfigQuery) error
  302. // Intercept is a dummy implementation of Intercept that returns the next Querier in the pipeline.
  303. func (f TraverseEmployeeConfig) Intercept(next ent.Querier) ent.Querier {
  304. return next
  305. }
  306. // Traverse calls f(ctx, q).
  307. func (f TraverseEmployeeConfig) Traverse(ctx context.Context, q ent.Query) error {
  308. if q, ok := q.(*ent.EmployeeConfigQuery); ok {
  309. return f(ctx, q)
  310. }
  311. return fmt.Errorf("unexpected query type %T. expect *ent.EmployeeConfigQuery", q)
  312. }
  313. // The LabelFunc type is an adapter to allow the use of ordinary function as a Querier.
  314. type LabelFunc func(context.Context, *ent.LabelQuery) (ent.Value, error)
  315. // Query calls f(ctx, q).
  316. func (f LabelFunc) Query(ctx context.Context, q ent.Query) (ent.Value, error) {
  317. if q, ok := q.(*ent.LabelQuery); ok {
  318. return f(ctx, q)
  319. }
  320. return nil, fmt.Errorf("unexpected query type %T. expect *ent.LabelQuery", q)
  321. }
  322. // The TraverseLabel type is an adapter to allow the use of ordinary function as Traverser.
  323. type TraverseLabel func(context.Context, *ent.LabelQuery) error
  324. // Intercept is a dummy implementation of Intercept that returns the next Querier in the pipeline.
  325. func (f TraverseLabel) Intercept(next ent.Querier) ent.Querier {
  326. return next
  327. }
  328. // Traverse calls f(ctx, q).
  329. func (f TraverseLabel) Traverse(ctx context.Context, q ent.Query) error {
  330. if q, ok := q.(*ent.LabelQuery); ok {
  331. return f(ctx, q)
  332. }
  333. return fmt.Errorf("unexpected query type %T. expect *ent.LabelQuery", q)
  334. }
  335. // The LabelRelationshipFunc type is an adapter to allow the use of ordinary function as a Querier.
  336. type LabelRelationshipFunc func(context.Context, *ent.LabelRelationshipQuery) (ent.Value, error)
  337. // Query calls f(ctx, q).
  338. func (f LabelRelationshipFunc) Query(ctx context.Context, q ent.Query) (ent.Value, error) {
  339. if q, ok := q.(*ent.LabelRelationshipQuery); ok {
  340. return f(ctx, q)
  341. }
  342. return nil, fmt.Errorf("unexpected query type %T. expect *ent.LabelRelationshipQuery", q)
  343. }
  344. // The TraverseLabelRelationship type is an adapter to allow the use of ordinary function as Traverser.
  345. type TraverseLabelRelationship func(context.Context, *ent.LabelRelationshipQuery) error
  346. // Intercept is a dummy implementation of Intercept that returns the next Querier in the pipeline.
  347. func (f TraverseLabelRelationship) Intercept(next ent.Querier) ent.Querier {
  348. return next
  349. }
  350. // Traverse calls f(ctx, q).
  351. func (f TraverseLabelRelationship) Traverse(ctx context.Context, q ent.Query) error {
  352. if q, ok := q.(*ent.LabelRelationshipQuery); ok {
  353. return f(ctx, q)
  354. }
  355. return fmt.Errorf("unexpected query type %T. expect *ent.LabelRelationshipQuery", q)
  356. }
  357. // The MessageFunc type is an adapter to allow the use of ordinary function as a Querier.
  358. type MessageFunc func(context.Context, *ent.MessageQuery) (ent.Value, error)
  359. // Query calls f(ctx, q).
  360. func (f MessageFunc) Query(ctx context.Context, q ent.Query) (ent.Value, error) {
  361. if q, ok := q.(*ent.MessageQuery); ok {
  362. return f(ctx, q)
  363. }
  364. return nil, fmt.Errorf("unexpected query type %T. expect *ent.MessageQuery", q)
  365. }
  366. // The TraverseMessage type is an adapter to allow the use of ordinary function as Traverser.
  367. type TraverseMessage func(context.Context, *ent.MessageQuery) error
  368. // Intercept is a dummy implementation of Intercept that returns the next Querier in the pipeline.
  369. func (f TraverseMessage) Intercept(next ent.Querier) ent.Querier {
  370. return next
  371. }
  372. // Traverse calls f(ctx, q).
  373. func (f TraverseMessage) Traverse(ctx context.Context, q ent.Query) error {
  374. if q, ok := q.(*ent.MessageQuery); ok {
  375. return f(ctx, q)
  376. }
  377. return fmt.Errorf("unexpected query type %T. expect *ent.MessageQuery", q)
  378. }
  379. // The MessageRecordsFunc type is an adapter to allow the use of ordinary function as a Querier.
  380. type MessageRecordsFunc func(context.Context, *ent.MessageRecordsQuery) (ent.Value, error)
  381. // Query calls f(ctx, q).
  382. func (f MessageRecordsFunc) Query(ctx context.Context, q ent.Query) (ent.Value, error) {
  383. if q, ok := q.(*ent.MessageRecordsQuery); ok {
  384. return f(ctx, q)
  385. }
  386. return nil, fmt.Errorf("unexpected query type %T. expect *ent.MessageRecordsQuery", q)
  387. }
  388. // The TraverseMessageRecords type is an adapter to allow the use of ordinary function as Traverser.
  389. type TraverseMessageRecords func(context.Context, *ent.MessageRecordsQuery) error
  390. // Intercept is a dummy implementation of Intercept that returns the next Querier in the pipeline.
  391. func (f TraverseMessageRecords) Intercept(next ent.Querier) ent.Querier {
  392. return next
  393. }
  394. // Traverse calls f(ctx, q).
  395. func (f TraverseMessageRecords) Traverse(ctx context.Context, q ent.Query) error {
  396. if q, ok := q.(*ent.MessageRecordsQuery); ok {
  397. return f(ctx, q)
  398. }
  399. return fmt.Errorf("unexpected query type %T. expect *ent.MessageRecordsQuery", q)
  400. }
  401. // The MsgFunc type is an adapter to allow the use of ordinary function as a Querier.
  402. type MsgFunc func(context.Context, *ent.MsgQuery) (ent.Value, error)
  403. // Query calls f(ctx, q).
  404. func (f MsgFunc) Query(ctx context.Context, q ent.Query) (ent.Value, error) {
  405. if q, ok := q.(*ent.MsgQuery); ok {
  406. return f(ctx, q)
  407. }
  408. return nil, fmt.Errorf("unexpected query type %T. expect *ent.MsgQuery", q)
  409. }
  410. // The TraverseMsg type is an adapter to allow the use of ordinary function as Traverser.
  411. type TraverseMsg func(context.Context, *ent.MsgQuery) error
  412. // Intercept is a dummy implementation of Intercept that returns the next Querier in the pipeline.
  413. func (f TraverseMsg) Intercept(next ent.Querier) ent.Querier {
  414. return next
  415. }
  416. // Traverse calls f(ctx, q).
  417. func (f TraverseMsg) Traverse(ctx context.Context, q ent.Query) error {
  418. if q, ok := q.(*ent.MsgQuery); ok {
  419. return f(ctx, q)
  420. }
  421. return fmt.Errorf("unexpected query type %T. expect *ent.MsgQuery", q)
  422. }
  423. // The ServerFunc type is an adapter to allow the use of ordinary function as a Querier.
  424. type ServerFunc func(context.Context, *ent.ServerQuery) (ent.Value, error)
  425. // Query calls f(ctx, q).
  426. func (f ServerFunc) Query(ctx context.Context, q ent.Query) (ent.Value, error) {
  427. if q, ok := q.(*ent.ServerQuery); ok {
  428. return f(ctx, q)
  429. }
  430. return nil, fmt.Errorf("unexpected query type %T. expect *ent.ServerQuery", q)
  431. }
  432. // The TraverseServer type is an adapter to allow the use of ordinary function as Traverser.
  433. type TraverseServer func(context.Context, *ent.ServerQuery) error
  434. // Intercept is a dummy implementation of Intercept that returns the next Querier in the pipeline.
  435. func (f TraverseServer) Intercept(next ent.Querier) ent.Querier {
  436. return next
  437. }
  438. // Traverse calls f(ctx, q).
  439. func (f TraverseServer) Traverse(ctx context.Context, q ent.Query) error {
  440. if q, ok := q.(*ent.ServerQuery); ok {
  441. return f(ctx, q)
  442. }
  443. return fmt.Errorf("unexpected query type %T. expect *ent.ServerQuery", q)
  444. }
  445. // The SopNodeFunc type is an adapter to allow the use of ordinary function as a Querier.
  446. type SopNodeFunc func(context.Context, *ent.SopNodeQuery) (ent.Value, error)
  447. // Query calls f(ctx, q).
  448. func (f SopNodeFunc) Query(ctx context.Context, q ent.Query) (ent.Value, error) {
  449. if q, ok := q.(*ent.SopNodeQuery); ok {
  450. return f(ctx, q)
  451. }
  452. return nil, fmt.Errorf("unexpected query type %T. expect *ent.SopNodeQuery", q)
  453. }
  454. // The TraverseSopNode type is an adapter to allow the use of ordinary function as Traverser.
  455. type TraverseSopNode func(context.Context, *ent.SopNodeQuery) error
  456. // Intercept is a dummy implementation of Intercept that returns the next Querier in the pipeline.
  457. func (f TraverseSopNode) Intercept(next ent.Querier) ent.Querier {
  458. return next
  459. }
  460. // Traverse calls f(ctx, q).
  461. func (f TraverseSopNode) Traverse(ctx context.Context, q ent.Query) error {
  462. if q, ok := q.(*ent.SopNodeQuery); ok {
  463. return f(ctx, q)
  464. }
  465. return fmt.Errorf("unexpected query type %T. expect *ent.SopNodeQuery", q)
  466. }
  467. // The SopStageFunc type is an adapter to allow the use of ordinary function as a Querier.
  468. type SopStageFunc func(context.Context, *ent.SopStageQuery) (ent.Value, error)
  469. // Query calls f(ctx, q).
  470. func (f SopStageFunc) Query(ctx context.Context, q ent.Query) (ent.Value, error) {
  471. if q, ok := q.(*ent.SopStageQuery); ok {
  472. return f(ctx, q)
  473. }
  474. return nil, fmt.Errorf("unexpected query type %T. expect *ent.SopStageQuery", q)
  475. }
  476. // The TraverseSopStage type is an adapter to allow the use of ordinary function as Traverser.
  477. type TraverseSopStage func(context.Context, *ent.SopStageQuery) error
  478. // Intercept is a dummy implementation of Intercept that returns the next Querier in the pipeline.
  479. func (f TraverseSopStage) Intercept(next ent.Querier) ent.Querier {
  480. return next
  481. }
  482. // Traverse calls f(ctx, q).
  483. func (f TraverseSopStage) Traverse(ctx context.Context, q ent.Query) error {
  484. if q, ok := q.(*ent.SopStageQuery); ok {
  485. return f(ctx, q)
  486. }
  487. return fmt.Errorf("unexpected query type %T. expect *ent.SopStageQuery", q)
  488. }
  489. // The SopTaskFunc type is an adapter to allow the use of ordinary function as a Querier.
  490. type SopTaskFunc func(context.Context, *ent.SopTaskQuery) (ent.Value, error)
  491. // Query calls f(ctx, q).
  492. func (f SopTaskFunc) Query(ctx context.Context, q ent.Query) (ent.Value, error) {
  493. if q, ok := q.(*ent.SopTaskQuery); ok {
  494. return f(ctx, q)
  495. }
  496. return nil, fmt.Errorf("unexpected query type %T. expect *ent.SopTaskQuery", q)
  497. }
  498. // The TraverseSopTask type is an adapter to allow the use of ordinary function as Traverser.
  499. type TraverseSopTask func(context.Context, *ent.SopTaskQuery) error
  500. // Intercept is a dummy implementation of Intercept that returns the next Querier in the pipeline.
  501. func (f TraverseSopTask) Intercept(next ent.Querier) ent.Querier {
  502. return next
  503. }
  504. // Traverse calls f(ctx, q).
  505. func (f TraverseSopTask) Traverse(ctx context.Context, q ent.Query) error {
  506. if q, ok := q.(*ent.SopTaskQuery); ok {
  507. return f(ctx, q)
  508. }
  509. return fmt.Errorf("unexpected query type %T. expect *ent.SopTaskQuery", q)
  510. }
  511. // The TokenFunc type is an adapter to allow the use of ordinary function as a Querier.
  512. type TokenFunc func(context.Context, *ent.TokenQuery) (ent.Value, error)
  513. // Query calls f(ctx, q).
  514. func (f TokenFunc) Query(ctx context.Context, q ent.Query) (ent.Value, error) {
  515. if q, ok := q.(*ent.TokenQuery); ok {
  516. return f(ctx, q)
  517. }
  518. return nil, fmt.Errorf("unexpected query type %T. expect *ent.TokenQuery", q)
  519. }
  520. // The TraverseToken type is an adapter to allow the use of ordinary function as Traverser.
  521. type TraverseToken func(context.Context, *ent.TokenQuery) error
  522. // Intercept is a dummy implementation of Intercept that returns the next Querier in the pipeline.
  523. func (f TraverseToken) Intercept(next ent.Querier) ent.Querier {
  524. return next
  525. }
  526. // Traverse calls f(ctx, q).
  527. func (f TraverseToken) Traverse(ctx context.Context, q ent.Query) error {
  528. if q, ok := q.(*ent.TokenQuery); ok {
  529. return f(ctx, q)
  530. }
  531. return fmt.Errorf("unexpected query type %T. expect *ent.TokenQuery", q)
  532. }
  533. // The TutorialFunc type is an adapter to allow the use of ordinary function as a Querier.
  534. type TutorialFunc func(context.Context, *ent.TutorialQuery) (ent.Value, error)
  535. // Query calls f(ctx, q).
  536. func (f TutorialFunc) Query(ctx context.Context, q ent.Query) (ent.Value, error) {
  537. if q, ok := q.(*ent.TutorialQuery); ok {
  538. return f(ctx, q)
  539. }
  540. return nil, fmt.Errorf("unexpected query type %T. expect *ent.TutorialQuery", q)
  541. }
  542. // The TraverseTutorial type is an adapter to allow the use of ordinary function as Traverser.
  543. type TraverseTutorial func(context.Context, *ent.TutorialQuery) error
  544. // Intercept is a dummy implementation of Intercept that returns the next Querier in the pipeline.
  545. func (f TraverseTutorial) Intercept(next ent.Querier) ent.Querier {
  546. return next
  547. }
  548. // Traverse calls f(ctx, q).
  549. func (f TraverseTutorial) Traverse(ctx context.Context, q ent.Query) error {
  550. if q, ok := q.(*ent.TutorialQuery); ok {
  551. return f(ctx, q)
  552. }
  553. return fmt.Errorf("unexpected query type %T. expect *ent.TutorialQuery", q)
  554. }
  555. // The UsageDetailFunc type is an adapter to allow the use of ordinary function as a Querier.
  556. type UsageDetailFunc func(context.Context, *ent.UsageDetailQuery) (ent.Value, error)
  557. // Query calls f(ctx, q).
  558. func (f UsageDetailFunc) Query(ctx context.Context, q ent.Query) (ent.Value, error) {
  559. if q, ok := q.(*ent.UsageDetailQuery); ok {
  560. return f(ctx, q)
  561. }
  562. return nil, fmt.Errorf("unexpected query type %T. expect *ent.UsageDetailQuery", q)
  563. }
  564. // The TraverseUsageDetail type is an adapter to allow the use of ordinary function as Traverser.
  565. type TraverseUsageDetail func(context.Context, *ent.UsageDetailQuery) error
  566. // Intercept is a dummy implementation of Intercept that returns the next Querier in the pipeline.
  567. func (f TraverseUsageDetail) Intercept(next ent.Querier) ent.Querier {
  568. return next
  569. }
  570. // Traverse calls f(ctx, q).
  571. func (f TraverseUsageDetail) Traverse(ctx context.Context, q ent.Query) error {
  572. if q, ok := q.(*ent.UsageDetailQuery); ok {
  573. return f(ctx, q)
  574. }
  575. return fmt.Errorf("unexpected query type %T. expect *ent.UsageDetailQuery", q)
  576. }
  577. // The UsageStatisticDayFunc type is an adapter to allow the use of ordinary function as a Querier.
  578. type UsageStatisticDayFunc func(context.Context, *ent.UsageStatisticDayQuery) (ent.Value, error)
  579. // Query calls f(ctx, q).
  580. func (f UsageStatisticDayFunc) Query(ctx context.Context, q ent.Query) (ent.Value, error) {
  581. if q, ok := q.(*ent.UsageStatisticDayQuery); ok {
  582. return f(ctx, q)
  583. }
  584. return nil, fmt.Errorf("unexpected query type %T. expect *ent.UsageStatisticDayQuery", q)
  585. }
  586. // The TraverseUsageStatisticDay type is an adapter to allow the use of ordinary function as Traverser.
  587. type TraverseUsageStatisticDay func(context.Context, *ent.UsageStatisticDayQuery) error
  588. // Intercept is a dummy implementation of Intercept that returns the next Querier in the pipeline.
  589. func (f TraverseUsageStatisticDay) Intercept(next ent.Querier) ent.Querier {
  590. return next
  591. }
  592. // Traverse calls f(ctx, q).
  593. func (f TraverseUsageStatisticDay) Traverse(ctx context.Context, q ent.Query) error {
  594. if q, ok := q.(*ent.UsageStatisticDayQuery); ok {
  595. return f(ctx, q)
  596. }
  597. return fmt.Errorf("unexpected query type %T. expect *ent.UsageStatisticDayQuery", q)
  598. }
  599. // The UsageStatisticHourFunc type is an adapter to allow the use of ordinary function as a Querier.
  600. type UsageStatisticHourFunc func(context.Context, *ent.UsageStatisticHourQuery) (ent.Value, error)
  601. // Query calls f(ctx, q).
  602. func (f UsageStatisticHourFunc) Query(ctx context.Context, q ent.Query) (ent.Value, error) {
  603. if q, ok := q.(*ent.UsageStatisticHourQuery); ok {
  604. return f(ctx, q)
  605. }
  606. return nil, fmt.Errorf("unexpected query type %T. expect *ent.UsageStatisticHourQuery", q)
  607. }
  608. // The TraverseUsageStatisticHour type is an adapter to allow the use of ordinary function as Traverser.
  609. type TraverseUsageStatisticHour func(context.Context, *ent.UsageStatisticHourQuery) error
  610. // Intercept is a dummy implementation of Intercept that returns the next Querier in the pipeline.
  611. func (f TraverseUsageStatisticHour) Intercept(next ent.Querier) ent.Querier {
  612. return next
  613. }
  614. // Traverse calls f(ctx, q).
  615. func (f TraverseUsageStatisticHour) Traverse(ctx context.Context, q ent.Query) error {
  616. if q, ok := q.(*ent.UsageStatisticHourQuery); ok {
  617. return f(ctx, q)
  618. }
  619. return fmt.Errorf("unexpected query type %T. expect *ent.UsageStatisticHourQuery", q)
  620. }
  621. // The UsageStatisticMonthFunc type is an adapter to allow the use of ordinary function as a Querier.
  622. type UsageStatisticMonthFunc func(context.Context, *ent.UsageStatisticMonthQuery) (ent.Value, error)
  623. // Query calls f(ctx, q).
  624. func (f UsageStatisticMonthFunc) Query(ctx context.Context, q ent.Query) (ent.Value, error) {
  625. if q, ok := q.(*ent.UsageStatisticMonthQuery); ok {
  626. return f(ctx, q)
  627. }
  628. return nil, fmt.Errorf("unexpected query type %T. expect *ent.UsageStatisticMonthQuery", q)
  629. }
  630. // The TraverseUsageStatisticMonth type is an adapter to allow the use of ordinary function as Traverser.
  631. type TraverseUsageStatisticMonth func(context.Context, *ent.UsageStatisticMonthQuery) error
  632. // Intercept is a dummy implementation of Intercept that returns the next Querier in the pipeline.
  633. func (f TraverseUsageStatisticMonth) Intercept(next ent.Querier) ent.Querier {
  634. return next
  635. }
  636. // Traverse calls f(ctx, q).
  637. func (f TraverseUsageStatisticMonth) Traverse(ctx context.Context, q ent.Query) error {
  638. if q, ok := q.(*ent.UsageStatisticMonthQuery); ok {
  639. return f(ctx, q)
  640. }
  641. return fmt.Errorf("unexpected query type %T. expect *ent.UsageStatisticMonthQuery", q)
  642. }
  643. // The UsageTotalFunc type is an adapter to allow the use of ordinary function as a Querier.
  644. type UsageTotalFunc func(context.Context, *ent.UsageTotalQuery) (ent.Value, error)
  645. // Query calls f(ctx, q).
  646. func (f UsageTotalFunc) Query(ctx context.Context, q ent.Query) (ent.Value, error) {
  647. if q, ok := q.(*ent.UsageTotalQuery); ok {
  648. return f(ctx, q)
  649. }
  650. return nil, fmt.Errorf("unexpected query type %T. expect *ent.UsageTotalQuery", q)
  651. }
  652. // The TraverseUsageTotal type is an adapter to allow the use of ordinary function as Traverser.
  653. type TraverseUsageTotal func(context.Context, *ent.UsageTotalQuery) error
  654. // Intercept is a dummy implementation of Intercept that returns the next Querier in the pipeline.
  655. func (f TraverseUsageTotal) Intercept(next ent.Querier) ent.Querier {
  656. return next
  657. }
  658. // Traverse calls f(ctx, q).
  659. func (f TraverseUsageTotal) Traverse(ctx context.Context, q ent.Query) error {
  660. if q, ok := q.(*ent.UsageTotalQuery); ok {
  661. return f(ctx, q)
  662. }
  663. return fmt.Errorf("unexpected query type %T. expect *ent.UsageTotalQuery", q)
  664. }
  665. // The WorkExperienceFunc type is an adapter to allow the use of ordinary function as a Querier.
  666. type WorkExperienceFunc func(context.Context, *ent.WorkExperienceQuery) (ent.Value, error)
  667. // Query calls f(ctx, q).
  668. func (f WorkExperienceFunc) Query(ctx context.Context, q ent.Query) (ent.Value, error) {
  669. if q, ok := q.(*ent.WorkExperienceQuery); ok {
  670. return f(ctx, q)
  671. }
  672. return nil, fmt.Errorf("unexpected query type %T. expect *ent.WorkExperienceQuery", q)
  673. }
  674. // The TraverseWorkExperience type is an adapter to allow the use of ordinary function as Traverser.
  675. type TraverseWorkExperience func(context.Context, *ent.WorkExperienceQuery) error
  676. // Intercept is a dummy implementation of Intercept that returns the next Querier in the pipeline.
  677. func (f TraverseWorkExperience) Intercept(next ent.Querier) ent.Querier {
  678. return next
  679. }
  680. // Traverse calls f(ctx, q).
  681. func (f TraverseWorkExperience) Traverse(ctx context.Context, q ent.Query) error {
  682. if q, ok := q.(*ent.WorkExperienceQuery); ok {
  683. return f(ctx, q)
  684. }
  685. return fmt.Errorf("unexpected query type %T. expect *ent.WorkExperienceQuery", q)
  686. }
  687. // The WpChatroomFunc type is an adapter to allow the use of ordinary function as a Querier.
  688. type WpChatroomFunc func(context.Context, *ent.WpChatroomQuery) (ent.Value, error)
  689. // Query calls f(ctx, q).
  690. func (f WpChatroomFunc) Query(ctx context.Context, q ent.Query) (ent.Value, error) {
  691. if q, ok := q.(*ent.WpChatroomQuery); ok {
  692. return f(ctx, q)
  693. }
  694. return nil, fmt.Errorf("unexpected query type %T. expect *ent.WpChatroomQuery", q)
  695. }
  696. // The TraverseWpChatroom type is an adapter to allow the use of ordinary function as Traverser.
  697. type TraverseWpChatroom func(context.Context, *ent.WpChatroomQuery) error
  698. // Intercept is a dummy implementation of Intercept that returns the next Querier in the pipeline.
  699. func (f TraverseWpChatroom) Intercept(next ent.Querier) ent.Querier {
  700. return next
  701. }
  702. // Traverse calls f(ctx, q).
  703. func (f TraverseWpChatroom) Traverse(ctx context.Context, q ent.Query) error {
  704. if q, ok := q.(*ent.WpChatroomQuery); ok {
  705. return f(ctx, q)
  706. }
  707. return fmt.Errorf("unexpected query type %T. expect *ent.WpChatroomQuery", q)
  708. }
  709. // The WpChatroomMemberFunc type is an adapter to allow the use of ordinary function as a Querier.
  710. type WpChatroomMemberFunc func(context.Context, *ent.WpChatroomMemberQuery) (ent.Value, error)
  711. // Query calls f(ctx, q).
  712. func (f WpChatroomMemberFunc) Query(ctx context.Context, q ent.Query) (ent.Value, error) {
  713. if q, ok := q.(*ent.WpChatroomMemberQuery); ok {
  714. return f(ctx, q)
  715. }
  716. return nil, fmt.Errorf("unexpected query type %T. expect *ent.WpChatroomMemberQuery", q)
  717. }
  718. // The TraverseWpChatroomMember type is an adapter to allow the use of ordinary function as Traverser.
  719. type TraverseWpChatroomMember func(context.Context, *ent.WpChatroomMemberQuery) error
  720. // Intercept is a dummy implementation of Intercept that returns the next Querier in the pipeline.
  721. func (f TraverseWpChatroomMember) Intercept(next ent.Querier) ent.Querier {
  722. return next
  723. }
  724. // Traverse calls f(ctx, q).
  725. func (f TraverseWpChatroomMember) Traverse(ctx context.Context, q ent.Query) error {
  726. if q, ok := q.(*ent.WpChatroomMemberQuery); ok {
  727. return f(ctx, q)
  728. }
  729. return fmt.Errorf("unexpected query type %T. expect *ent.WpChatroomMemberQuery", q)
  730. }
  731. // The WxFunc type is an adapter to allow the use of ordinary function as a Querier.
  732. type WxFunc func(context.Context, *ent.WxQuery) (ent.Value, error)
  733. // Query calls f(ctx, q).
  734. func (f WxFunc) Query(ctx context.Context, q ent.Query) (ent.Value, error) {
  735. if q, ok := q.(*ent.WxQuery); ok {
  736. return f(ctx, q)
  737. }
  738. return nil, fmt.Errorf("unexpected query type %T. expect *ent.WxQuery", q)
  739. }
  740. // The TraverseWx type is an adapter to allow the use of ordinary function as Traverser.
  741. type TraverseWx func(context.Context, *ent.WxQuery) error
  742. // Intercept is a dummy implementation of Intercept that returns the next Querier in the pipeline.
  743. func (f TraverseWx) Intercept(next ent.Querier) ent.Querier {
  744. return next
  745. }
  746. // Traverse calls f(ctx, q).
  747. func (f TraverseWx) Traverse(ctx context.Context, q ent.Query) error {
  748. if q, ok := q.(*ent.WxQuery); ok {
  749. return f(ctx, q)
  750. }
  751. return fmt.Errorf("unexpected query type %T. expect *ent.WxQuery", q)
  752. }
  753. // The WxCardFunc type is an adapter to allow the use of ordinary function as a Querier.
  754. type WxCardFunc func(context.Context, *ent.WxCardQuery) (ent.Value, error)
  755. // Query calls f(ctx, q).
  756. func (f WxCardFunc) Query(ctx context.Context, q ent.Query) (ent.Value, error) {
  757. if q, ok := q.(*ent.WxCardQuery); ok {
  758. return f(ctx, q)
  759. }
  760. return nil, fmt.Errorf("unexpected query type %T. expect *ent.WxCardQuery", q)
  761. }
  762. // The TraverseWxCard type is an adapter to allow the use of ordinary function as Traverser.
  763. type TraverseWxCard func(context.Context, *ent.WxCardQuery) error
  764. // Intercept is a dummy implementation of Intercept that returns the next Querier in the pipeline.
  765. func (f TraverseWxCard) Intercept(next ent.Querier) ent.Querier {
  766. return next
  767. }
  768. // Traverse calls f(ctx, q).
  769. func (f TraverseWxCard) Traverse(ctx context.Context, q ent.Query) error {
  770. if q, ok := q.(*ent.WxCardQuery); ok {
  771. return f(ctx, q)
  772. }
  773. return fmt.Errorf("unexpected query type %T. expect *ent.WxCardQuery", q)
  774. }
  775. // The WxCardUserFunc type is an adapter to allow the use of ordinary function as a Querier.
  776. type WxCardUserFunc func(context.Context, *ent.WxCardUserQuery) (ent.Value, error)
  777. // Query calls f(ctx, q).
  778. func (f WxCardUserFunc) Query(ctx context.Context, q ent.Query) (ent.Value, error) {
  779. if q, ok := q.(*ent.WxCardUserQuery); ok {
  780. return f(ctx, q)
  781. }
  782. return nil, fmt.Errorf("unexpected query type %T. expect *ent.WxCardUserQuery", q)
  783. }
  784. // The TraverseWxCardUser type is an adapter to allow the use of ordinary function as Traverser.
  785. type TraverseWxCardUser func(context.Context, *ent.WxCardUserQuery) error
  786. // Intercept is a dummy implementation of Intercept that returns the next Querier in the pipeline.
  787. func (f TraverseWxCardUser) Intercept(next ent.Querier) ent.Querier {
  788. return next
  789. }
  790. // Traverse calls f(ctx, q).
  791. func (f TraverseWxCardUser) Traverse(ctx context.Context, q ent.Query) error {
  792. if q, ok := q.(*ent.WxCardUserQuery); ok {
  793. return f(ctx, q)
  794. }
  795. return fmt.Errorf("unexpected query type %T. expect *ent.WxCardUserQuery", q)
  796. }
  797. // The WxCardVisitFunc type is an adapter to allow the use of ordinary function as a Querier.
  798. type WxCardVisitFunc func(context.Context, *ent.WxCardVisitQuery) (ent.Value, error)
  799. // Query calls f(ctx, q).
  800. func (f WxCardVisitFunc) Query(ctx context.Context, q ent.Query) (ent.Value, error) {
  801. if q, ok := q.(*ent.WxCardVisitQuery); ok {
  802. return f(ctx, q)
  803. }
  804. return nil, fmt.Errorf("unexpected query type %T. expect *ent.WxCardVisitQuery", q)
  805. }
  806. // The TraverseWxCardVisit type is an adapter to allow the use of ordinary function as Traverser.
  807. type TraverseWxCardVisit func(context.Context, *ent.WxCardVisitQuery) error
  808. // Intercept is a dummy implementation of Intercept that returns the next Querier in the pipeline.
  809. func (f TraverseWxCardVisit) Intercept(next ent.Querier) ent.Querier {
  810. return next
  811. }
  812. // Traverse calls f(ctx, q).
  813. func (f TraverseWxCardVisit) Traverse(ctx context.Context, q ent.Query) error {
  814. if q, ok := q.(*ent.WxCardVisitQuery); ok {
  815. return f(ctx, q)
  816. }
  817. return fmt.Errorf("unexpected query type %T. expect *ent.WxCardVisitQuery", q)
  818. }
  819. // NewQuery returns the generic Query interface for the given typed query.
  820. func NewQuery(q ent.Query) (Query, error) {
  821. switch q := q.(type) {
  822. case *ent.AgentQuery:
  823. return &query[*ent.AgentQuery, predicate.Agent, agent.OrderOption]{typ: ent.TypeAgent, tq: q}, nil
  824. case *ent.AgentBaseQuery:
  825. return &query[*ent.AgentBaseQuery, predicate.AgentBase, agentbase.OrderOption]{typ: ent.TypeAgentBase, tq: q}, nil
  826. case *ent.AliyunAvatarQuery:
  827. return &query[*ent.AliyunAvatarQuery, predicate.AliyunAvatar, aliyunavatar.OrderOption]{typ: ent.TypeAliyunAvatar, tq: q}, nil
  828. case *ent.BatchMsgQuery:
  829. return &query[*ent.BatchMsgQuery, predicate.BatchMsg, batchmsg.OrderOption]{typ: ent.TypeBatchMsg, tq: q}, nil
  830. case *ent.CategoryQuery:
  831. return &query[*ent.CategoryQuery, predicate.Category, category.OrderOption]{typ: ent.TypeCategory, tq: q}, nil
  832. case *ent.ChatRecordsQuery:
  833. return &query[*ent.ChatRecordsQuery, predicate.ChatRecords, chatrecords.OrderOption]{typ: ent.TypeChatRecords, tq: q}, nil
  834. case *ent.ChatSessionQuery:
  835. return &query[*ent.ChatSessionQuery, predicate.ChatSession, chatsession.OrderOption]{typ: ent.TypeChatSession, tq: q}, nil
  836. case *ent.ContactQuery:
  837. return &query[*ent.ContactQuery, predicate.Contact, contact.OrderOption]{typ: ent.TypeContact, tq: q}, nil
  838. case *ent.EmployeeQuery:
  839. return &query[*ent.EmployeeQuery, predicate.Employee, employee.OrderOption]{typ: ent.TypeEmployee, tq: q}, nil
  840. case *ent.EmployeeConfigQuery:
  841. return &query[*ent.EmployeeConfigQuery, predicate.EmployeeConfig, employeeconfig.OrderOption]{typ: ent.TypeEmployeeConfig, tq: q}, nil
  842. case *ent.LabelQuery:
  843. return &query[*ent.LabelQuery, predicate.Label, label.OrderOption]{typ: ent.TypeLabel, tq: q}, nil
  844. case *ent.LabelRelationshipQuery:
  845. return &query[*ent.LabelRelationshipQuery, predicate.LabelRelationship, labelrelationship.OrderOption]{typ: ent.TypeLabelRelationship, tq: q}, nil
  846. case *ent.MessageQuery:
  847. return &query[*ent.MessageQuery, predicate.Message, message.OrderOption]{typ: ent.TypeMessage, tq: q}, nil
  848. case *ent.MessageRecordsQuery:
  849. return &query[*ent.MessageRecordsQuery, predicate.MessageRecords, messagerecords.OrderOption]{typ: ent.TypeMessageRecords, tq: q}, nil
  850. case *ent.MsgQuery:
  851. return &query[*ent.MsgQuery, predicate.Msg, msg.OrderOption]{typ: ent.TypeMsg, tq: q}, nil
  852. case *ent.ServerQuery:
  853. return &query[*ent.ServerQuery, predicate.Server, server.OrderOption]{typ: ent.TypeServer, tq: q}, nil
  854. case *ent.SopNodeQuery:
  855. return &query[*ent.SopNodeQuery, predicate.SopNode, sopnode.OrderOption]{typ: ent.TypeSopNode, tq: q}, nil
  856. case *ent.SopStageQuery:
  857. return &query[*ent.SopStageQuery, predicate.SopStage, sopstage.OrderOption]{typ: ent.TypeSopStage, tq: q}, nil
  858. case *ent.SopTaskQuery:
  859. return &query[*ent.SopTaskQuery, predicate.SopTask, soptask.OrderOption]{typ: ent.TypeSopTask, tq: q}, nil
  860. case *ent.TokenQuery:
  861. return &query[*ent.TokenQuery, predicate.Token, token.OrderOption]{typ: ent.TypeToken, tq: q}, nil
  862. case *ent.TutorialQuery:
  863. return &query[*ent.TutorialQuery, predicate.Tutorial, tutorial.OrderOption]{typ: ent.TypeTutorial, tq: q}, nil
  864. case *ent.UsageDetailQuery:
  865. return &query[*ent.UsageDetailQuery, predicate.UsageDetail, usagedetail.OrderOption]{typ: ent.TypeUsageDetail, tq: q}, nil
  866. case *ent.UsageStatisticDayQuery:
  867. return &query[*ent.UsageStatisticDayQuery, predicate.UsageStatisticDay, usagestatisticday.OrderOption]{typ: ent.TypeUsageStatisticDay, tq: q}, nil
  868. case *ent.UsageStatisticHourQuery:
  869. return &query[*ent.UsageStatisticHourQuery, predicate.UsageStatisticHour, usagestatistichour.OrderOption]{typ: ent.TypeUsageStatisticHour, tq: q}, nil
  870. case *ent.UsageStatisticMonthQuery:
  871. return &query[*ent.UsageStatisticMonthQuery, predicate.UsageStatisticMonth, usagestatisticmonth.OrderOption]{typ: ent.TypeUsageStatisticMonth, tq: q}, nil
  872. case *ent.UsageTotalQuery:
  873. return &query[*ent.UsageTotalQuery, predicate.UsageTotal, usagetotal.OrderOption]{typ: ent.TypeUsageTotal, tq: q}, nil
  874. case *ent.WorkExperienceQuery:
  875. return &query[*ent.WorkExperienceQuery, predicate.WorkExperience, workexperience.OrderOption]{typ: ent.TypeWorkExperience, tq: q}, nil
  876. case *ent.WpChatroomQuery:
  877. return &query[*ent.WpChatroomQuery, predicate.WpChatroom, wpchatroom.OrderOption]{typ: ent.TypeWpChatroom, tq: q}, nil
  878. case *ent.WpChatroomMemberQuery:
  879. return &query[*ent.WpChatroomMemberQuery, predicate.WpChatroomMember, wpchatroommember.OrderOption]{typ: ent.TypeWpChatroomMember, tq: q}, nil
  880. case *ent.WxQuery:
  881. return &query[*ent.WxQuery, predicate.Wx, wx.OrderOption]{typ: ent.TypeWx, tq: q}, nil
  882. case *ent.WxCardQuery:
  883. return &query[*ent.WxCardQuery, predicate.WxCard, wxcard.OrderOption]{typ: ent.TypeWxCard, tq: q}, nil
  884. case *ent.WxCardUserQuery:
  885. return &query[*ent.WxCardUserQuery, predicate.WxCardUser, wxcarduser.OrderOption]{typ: ent.TypeWxCardUser, tq: q}, nil
  886. case *ent.WxCardVisitQuery:
  887. return &query[*ent.WxCardVisitQuery, predicate.WxCardVisit, wxcardvisit.OrderOption]{typ: ent.TypeWxCardVisit, tq: q}, nil
  888. default:
  889. return nil, fmt.Errorf("unknown query type %T", q)
  890. }
  891. }
  892. type query[T any, P ~func(*sql.Selector), R ~func(*sql.Selector)] struct {
  893. typ string
  894. tq interface {
  895. Limit(int) T
  896. Offset(int) T
  897. Unique(bool) T
  898. Order(...R) T
  899. Where(...P) T
  900. }
  901. }
  902. func (q query[T, P, R]) Type() string {
  903. return q.typ
  904. }
  905. func (q query[T, P, R]) Limit(limit int) {
  906. q.tq.Limit(limit)
  907. }
  908. func (q query[T, P, R]) Offset(offset int) {
  909. q.tq.Offset(offset)
  910. }
  911. func (q query[T, P, R]) Unique(unique bool) {
  912. q.tq.Unique(unique)
  913. }
  914. func (q query[T, P, R]) Order(orders ...func(*sql.Selector)) {
  915. rs := make([]R, len(orders))
  916. for i := range orders {
  917. rs[i] = orders[i]
  918. }
  919. q.tq.Order(rs...)
  920. }
  921. func (q query[T, P, R]) WhereP(ps ...func(*sql.Selector)) {
  922. p := make([]P, len(ps))
  923. for i := range ps {
  924. p[i] = ps[i]
  925. }
  926. q.tq.Where(p...)
  927. }