intercept.go 51 KB

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