intercept.go 60 KB

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