intercept.go 59 KB

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