intercept.go 49 KB

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