intercept.go 48 KB

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