intercept.go 56 KB

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