intercept.go 44 KB

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