intercept.go 61 KB

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