intercept.go 56 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319
  1. // Code generated by ent, DO NOT EDIT.
  2. package intercept
  3. import (
  4. "context"
  5. "fmt"
  6. "entgo.io/ent/dialect/sql"
  7. "github.com/Wei-Shaw/sub2api/ent"
  8. "github.com/Wei-Shaw/sub2api/ent/account"
  9. "github.com/Wei-Shaw/sub2api/ent/accountgroup"
  10. "github.com/Wei-Shaw/sub2api/ent/announcement"
  11. "github.com/Wei-Shaw/sub2api/ent/announcementread"
  12. "github.com/Wei-Shaw/sub2api/ent/apikey"
  13. "github.com/Wei-Shaw/sub2api/ent/authidentity"
  14. "github.com/Wei-Shaw/sub2api/ent/authidentitychannel"
  15. "github.com/Wei-Shaw/sub2api/ent/batchimageevent"
  16. "github.com/Wei-Shaw/sub2api/ent/batchimageitem"
  17. "github.com/Wei-Shaw/sub2api/ent/batchimagejob"
  18. "github.com/Wei-Shaw/sub2api/ent/channelmonitor"
  19. "github.com/Wei-Shaw/sub2api/ent/channelmonitordailyrollup"
  20. "github.com/Wei-Shaw/sub2api/ent/channelmonitorhistory"
  21. "github.com/Wei-Shaw/sub2api/ent/channelmonitorrequesttemplate"
  22. "github.com/Wei-Shaw/sub2api/ent/compositemodelroute"
  23. "github.com/Wei-Shaw/sub2api/ent/errorpassthroughrule"
  24. "github.com/Wei-Shaw/sub2api/ent/group"
  25. "github.com/Wei-Shaw/sub2api/ent/idempotencyrecord"
  26. "github.com/Wei-Shaw/sub2api/ent/identityadoptiondecision"
  27. "github.com/Wei-Shaw/sub2api/ent/paymentauditlog"
  28. "github.com/Wei-Shaw/sub2api/ent/paymentorder"
  29. "github.com/Wei-Shaw/sub2api/ent/paymentproviderinstance"
  30. "github.com/Wei-Shaw/sub2api/ent/pendingauthsession"
  31. "github.com/Wei-Shaw/sub2api/ent/predicate"
  32. "github.com/Wei-Shaw/sub2api/ent/promocode"
  33. "github.com/Wei-Shaw/sub2api/ent/promocodeusage"
  34. "github.com/Wei-Shaw/sub2api/ent/proxy"
  35. "github.com/Wei-Shaw/sub2api/ent/redeemcode"
  36. "github.com/Wei-Shaw/sub2api/ent/securitypolicykeyword"
  37. "github.com/Wei-Shaw/sub2api/ent/securitysecret"
  38. "github.com/Wei-Shaw/sub2api/ent/setting"
  39. "github.com/Wei-Shaw/sub2api/ent/subscriptionplan"
  40. "github.com/Wei-Shaw/sub2api/ent/tlsfingerprintprofile"
  41. "github.com/Wei-Shaw/sub2api/ent/usagecleanuptask"
  42. "github.com/Wei-Shaw/sub2api/ent/usagelog"
  43. "github.com/Wei-Shaw/sub2api/ent/user"
  44. "github.com/Wei-Shaw/sub2api/ent/userallowedgroup"
  45. "github.com/Wei-Shaw/sub2api/ent/userattributedefinition"
  46. "github.com/Wei-Shaw/sub2api/ent/userattributevalue"
  47. "github.com/Wei-Shaw/sub2api/ent/userplatformquota"
  48. "github.com/Wei-Shaw/sub2api/ent/usersubscription"
  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 APIKeyFunc type is an adapter to allow the use of ordinary function as a Querier.
  101. type APIKeyFunc func(context.Context, *ent.APIKeyQuery) (ent.Value, error)
  102. // Query calls f(ctx, q).
  103. func (f APIKeyFunc) Query(ctx context.Context, q ent.Query) (ent.Value, error) {
  104. if q, ok := q.(*ent.APIKeyQuery); ok {
  105. return f(ctx, q)
  106. }
  107. return nil, fmt.Errorf("unexpected query type %T. expect *ent.APIKeyQuery", q)
  108. }
  109. // The TraverseAPIKey type is an adapter to allow the use of ordinary function as Traverser.
  110. type TraverseAPIKey func(context.Context, *ent.APIKeyQuery) error
  111. // Intercept is a dummy implementation of Intercept that returns the next Querier in the pipeline.
  112. func (f TraverseAPIKey) Intercept(next ent.Querier) ent.Querier {
  113. return next
  114. }
  115. // Traverse calls f(ctx, q).
  116. func (f TraverseAPIKey) Traverse(ctx context.Context, q ent.Query) error {
  117. if q, ok := q.(*ent.APIKeyQuery); ok {
  118. return f(ctx, q)
  119. }
  120. return fmt.Errorf("unexpected query type %T. expect *ent.APIKeyQuery", q)
  121. }
  122. // The AccountFunc type is an adapter to allow the use of ordinary function as a Querier.
  123. type AccountFunc func(context.Context, *ent.AccountQuery) (ent.Value, error)
  124. // Query calls f(ctx, q).
  125. func (f AccountFunc) Query(ctx context.Context, q ent.Query) (ent.Value, error) {
  126. if q, ok := q.(*ent.AccountQuery); ok {
  127. return f(ctx, q)
  128. }
  129. return nil, fmt.Errorf("unexpected query type %T. expect *ent.AccountQuery", q)
  130. }
  131. // The TraverseAccount type is an adapter to allow the use of ordinary function as Traverser.
  132. type TraverseAccount func(context.Context, *ent.AccountQuery) error
  133. // Intercept is a dummy implementation of Intercept that returns the next Querier in the pipeline.
  134. func (f TraverseAccount) Intercept(next ent.Querier) ent.Querier {
  135. return next
  136. }
  137. // Traverse calls f(ctx, q).
  138. func (f TraverseAccount) Traverse(ctx context.Context, q ent.Query) error {
  139. if q, ok := q.(*ent.AccountQuery); ok {
  140. return f(ctx, q)
  141. }
  142. return fmt.Errorf("unexpected query type %T. expect *ent.AccountQuery", q)
  143. }
  144. // The AccountGroupFunc type is an adapter to allow the use of ordinary function as a Querier.
  145. type AccountGroupFunc func(context.Context, *ent.AccountGroupQuery) (ent.Value, error)
  146. // Query calls f(ctx, q).
  147. func (f AccountGroupFunc) Query(ctx context.Context, q ent.Query) (ent.Value, error) {
  148. if q, ok := q.(*ent.AccountGroupQuery); ok {
  149. return f(ctx, q)
  150. }
  151. return nil, fmt.Errorf("unexpected query type %T. expect *ent.AccountGroupQuery", q)
  152. }
  153. // The TraverseAccountGroup type is an adapter to allow the use of ordinary function as Traverser.
  154. type TraverseAccountGroup func(context.Context, *ent.AccountGroupQuery) error
  155. // Intercept is a dummy implementation of Intercept that returns the next Querier in the pipeline.
  156. func (f TraverseAccountGroup) Intercept(next ent.Querier) ent.Querier {
  157. return next
  158. }
  159. // Traverse calls f(ctx, q).
  160. func (f TraverseAccountGroup) Traverse(ctx context.Context, q ent.Query) error {
  161. if q, ok := q.(*ent.AccountGroupQuery); ok {
  162. return f(ctx, q)
  163. }
  164. return fmt.Errorf("unexpected query type %T. expect *ent.AccountGroupQuery", q)
  165. }
  166. // The AnnouncementFunc type is an adapter to allow the use of ordinary function as a Querier.
  167. type AnnouncementFunc func(context.Context, *ent.AnnouncementQuery) (ent.Value, error)
  168. // Query calls f(ctx, q).
  169. func (f AnnouncementFunc) Query(ctx context.Context, q ent.Query) (ent.Value, error) {
  170. if q, ok := q.(*ent.AnnouncementQuery); ok {
  171. return f(ctx, q)
  172. }
  173. return nil, fmt.Errorf("unexpected query type %T. expect *ent.AnnouncementQuery", q)
  174. }
  175. // The TraverseAnnouncement type is an adapter to allow the use of ordinary function as Traverser.
  176. type TraverseAnnouncement func(context.Context, *ent.AnnouncementQuery) error
  177. // Intercept is a dummy implementation of Intercept that returns the next Querier in the pipeline.
  178. func (f TraverseAnnouncement) Intercept(next ent.Querier) ent.Querier {
  179. return next
  180. }
  181. // Traverse calls f(ctx, q).
  182. func (f TraverseAnnouncement) Traverse(ctx context.Context, q ent.Query) error {
  183. if q, ok := q.(*ent.AnnouncementQuery); ok {
  184. return f(ctx, q)
  185. }
  186. return fmt.Errorf("unexpected query type %T. expect *ent.AnnouncementQuery", q)
  187. }
  188. // The AnnouncementReadFunc type is an adapter to allow the use of ordinary function as a Querier.
  189. type AnnouncementReadFunc func(context.Context, *ent.AnnouncementReadQuery) (ent.Value, error)
  190. // Query calls f(ctx, q).
  191. func (f AnnouncementReadFunc) Query(ctx context.Context, q ent.Query) (ent.Value, error) {
  192. if q, ok := q.(*ent.AnnouncementReadQuery); ok {
  193. return f(ctx, q)
  194. }
  195. return nil, fmt.Errorf("unexpected query type %T. expect *ent.AnnouncementReadQuery", q)
  196. }
  197. // The TraverseAnnouncementRead type is an adapter to allow the use of ordinary function as Traverser.
  198. type TraverseAnnouncementRead func(context.Context, *ent.AnnouncementReadQuery) error
  199. // Intercept is a dummy implementation of Intercept that returns the next Querier in the pipeline.
  200. func (f TraverseAnnouncementRead) Intercept(next ent.Querier) ent.Querier {
  201. return next
  202. }
  203. // Traverse calls f(ctx, q).
  204. func (f TraverseAnnouncementRead) Traverse(ctx context.Context, q ent.Query) error {
  205. if q, ok := q.(*ent.AnnouncementReadQuery); ok {
  206. return f(ctx, q)
  207. }
  208. return fmt.Errorf("unexpected query type %T. expect *ent.AnnouncementReadQuery", q)
  209. }
  210. // The AuthIdentityFunc type is an adapter to allow the use of ordinary function as a Querier.
  211. type AuthIdentityFunc func(context.Context, *ent.AuthIdentityQuery) (ent.Value, error)
  212. // Query calls f(ctx, q).
  213. func (f AuthIdentityFunc) Query(ctx context.Context, q ent.Query) (ent.Value, error) {
  214. if q, ok := q.(*ent.AuthIdentityQuery); ok {
  215. return f(ctx, q)
  216. }
  217. return nil, fmt.Errorf("unexpected query type %T. expect *ent.AuthIdentityQuery", q)
  218. }
  219. // The TraverseAuthIdentity type is an adapter to allow the use of ordinary function as Traverser.
  220. type TraverseAuthIdentity func(context.Context, *ent.AuthIdentityQuery) error
  221. // Intercept is a dummy implementation of Intercept that returns the next Querier in the pipeline.
  222. func (f TraverseAuthIdentity) Intercept(next ent.Querier) ent.Querier {
  223. return next
  224. }
  225. // Traverse calls f(ctx, q).
  226. func (f TraverseAuthIdentity) Traverse(ctx context.Context, q ent.Query) error {
  227. if q, ok := q.(*ent.AuthIdentityQuery); ok {
  228. return f(ctx, q)
  229. }
  230. return fmt.Errorf("unexpected query type %T. expect *ent.AuthIdentityQuery", q)
  231. }
  232. // The AuthIdentityChannelFunc type is an adapter to allow the use of ordinary function as a Querier.
  233. type AuthIdentityChannelFunc func(context.Context, *ent.AuthIdentityChannelQuery) (ent.Value, error)
  234. // Query calls f(ctx, q).
  235. func (f AuthIdentityChannelFunc) Query(ctx context.Context, q ent.Query) (ent.Value, error) {
  236. if q, ok := q.(*ent.AuthIdentityChannelQuery); ok {
  237. return f(ctx, q)
  238. }
  239. return nil, fmt.Errorf("unexpected query type %T. expect *ent.AuthIdentityChannelQuery", q)
  240. }
  241. // The TraverseAuthIdentityChannel type is an adapter to allow the use of ordinary function as Traverser.
  242. type TraverseAuthIdentityChannel func(context.Context, *ent.AuthIdentityChannelQuery) error
  243. // Intercept is a dummy implementation of Intercept that returns the next Querier in the pipeline.
  244. func (f TraverseAuthIdentityChannel) Intercept(next ent.Querier) ent.Querier {
  245. return next
  246. }
  247. // Traverse calls f(ctx, q).
  248. func (f TraverseAuthIdentityChannel) Traverse(ctx context.Context, q ent.Query) error {
  249. if q, ok := q.(*ent.AuthIdentityChannelQuery); ok {
  250. return f(ctx, q)
  251. }
  252. return fmt.Errorf("unexpected query type %T. expect *ent.AuthIdentityChannelQuery", q)
  253. }
  254. // The BatchImageEventFunc type is an adapter to allow the use of ordinary function as a Querier.
  255. type BatchImageEventFunc func(context.Context, *ent.BatchImageEventQuery) (ent.Value, error)
  256. // Query calls f(ctx, q).
  257. func (f BatchImageEventFunc) Query(ctx context.Context, q ent.Query) (ent.Value, error) {
  258. if q, ok := q.(*ent.BatchImageEventQuery); ok {
  259. return f(ctx, q)
  260. }
  261. return nil, fmt.Errorf("unexpected query type %T. expect *ent.BatchImageEventQuery", q)
  262. }
  263. // The TraverseBatchImageEvent type is an adapter to allow the use of ordinary function as Traverser.
  264. type TraverseBatchImageEvent func(context.Context, *ent.BatchImageEventQuery) error
  265. // Intercept is a dummy implementation of Intercept that returns the next Querier in the pipeline.
  266. func (f TraverseBatchImageEvent) Intercept(next ent.Querier) ent.Querier {
  267. return next
  268. }
  269. // Traverse calls f(ctx, q).
  270. func (f TraverseBatchImageEvent) Traverse(ctx context.Context, q ent.Query) error {
  271. if q, ok := q.(*ent.BatchImageEventQuery); ok {
  272. return f(ctx, q)
  273. }
  274. return fmt.Errorf("unexpected query type %T. expect *ent.BatchImageEventQuery", q)
  275. }
  276. // The BatchImageItemFunc type is an adapter to allow the use of ordinary function as a Querier.
  277. type BatchImageItemFunc func(context.Context, *ent.BatchImageItemQuery) (ent.Value, error)
  278. // Query calls f(ctx, q).
  279. func (f BatchImageItemFunc) Query(ctx context.Context, q ent.Query) (ent.Value, error) {
  280. if q, ok := q.(*ent.BatchImageItemQuery); ok {
  281. return f(ctx, q)
  282. }
  283. return nil, fmt.Errorf("unexpected query type %T. expect *ent.BatchImageItemQuery", q)
  284. }
  285. // The TraverseBatchImageItem type is an adapter to allow the use of ordinary function as Traverser.
  286. type TraverseBatchImageItem func(context.Context, *ent.BatchImageItemQuery) error
  287. // Intercept is a dummy implementation of Intercept that returns the next Querier in the pipeline.
  288. func (f TraverseBatchImageItem) Intercept(next ent.Querier) ent.Querier {
  289. return next
  290. }
  291. // Traverse calls f(ctx, q).
  292. func (f TraverseBatchImageItem) Traverse(ctx context.Context, q ent.Query) error {
  293. if q, ok := q.(*ent.BatchImageItemQuery); ok {
  294. return f(ctx, q)
  295. }
  296. return fmt.Errorf("unexpected query type %T. expect *ent.BatchImageItemQuery", q)
  297. }
  298. // The BatchImageJobFunc type is an adapter to allow the use of ordinary function as a Querier.
  299. type BatchImageJobFunc func(context.Context, *ent.BatchImageJobQuery) (ent.Value, error)
  300. // Query calls f(ctx, q).
  301. func (f BatchImageJobFunc) Query(ctx context.Context, q ent.Query) (ent.Value, error) {
  302. if q, ok := q.(*ent.BatchImageJobQuery); ok {
  303. return f(ctx, q)
  304. }
  305. return nil, fmt.Errorf("unexpected query type %T. expect *ent.BatchImageJobQuery", q)
  306. }
  307. // The TraverseBatchImageJob type is an adapter to allow the use of ordinary function as Traverser.
  308. type TraverseBatchImageJob func(context.Context, *ent.BatchImageJobQuery) error
  309. // Intercept is a dummy implementation of Intercept that returns the next Querier in the pipeline.
  310. func (f TraverseBatchImageJob) Intercept(next ent.Querier) ent.Querier {
  311. return next
  312. }
  313. // Traverse calls f(ctx, q).
  314. func (f TraverseBatchImageJob) Traverse(ctx context.Context, q ent.Query) error {
  315. if q, ok := q.(*ent.BatchImageJobQuery); ok {
  316. return f(ctx, q)
  317. }
  318. return fmt.Errorf("unexpected query type %T. expect *ent.BatchImageJobQuery", q)
  319. }
  320. // The ChannelMonitorFunc type is an adapter to allow the use of ordinary function as a Querier.
  321. type ChannelMonitorFunc func(context.Context, *ent.ChannelMonitorQuery) (ent.Value, error)
  322. // Query calls f(ctx, q).
  323. func (f ChannelMonitorFunc) Query(ctx context.Context, q ent.Query) (ent.Value, error) {
  324. if q, ok := q.(*ent.ChannelMonitorQuery); ok {
  325. return f(ctx, q)
  326. }
  327. return nil, fmt.Errorf("unexpected query type %T. expect *ent.ChannelMonitorQuery", q)
  328. }
  329. // The TraverseChannelMonitor type is an adapter to allow the use of ordinary function as Traverser.
  330. type TraverseChannelMonitor func(context.Context, *ent.ChannelMonitorQuery) error
  331. // Intercept is a dummy implementation of Intercept that returns the next Querier in the pipeline.
  332. func (f TraverseChannelMonitor) Intercept(next ent.Querier) ent.Querier {
  333. return next
  334. }
  335. // Traverse calls f(ctx, q).
  336. func (f TraverseChannelMonitor) Traverse(ctx context.Context, q ent.Query) error {
  337. if q, ok := q.(*ent.ChannelMonitorQuery); ok {
  338. return f(ctx, q)
  339. }
  340. return fmt.Errorf("unexpected query type %T. expect *ent.ChannelMonitorQuery", q)
  341. }
  342. // The ChannelMonitorDailyRollupFunc type is an adapter to allow the use of ordinary function as a Querier.
  343. type ChannelMonitorDailyRollupFunc func(context.Context, *ent.ChannelMonitorDailyRollupQuery) (ent.Value, error)
  344. // Query calls f(ctx, q).
  345. func (f ChannelMonitorDailyRollupFunc) Query(ctx context.Context, q ent.Query) (ent.Value, error) {
  346. if q, ok := q.(*ent.ChannelMonitorDailyRollupQuery); ok {
  347. return f(ctx, q)
  348. }
  349. return nil, fmt.Errorf("unexpected query type %T. expect *ent.ChannelMonitorDailyRollupQuery", q)
  350. }
  351. // The TraverseChannelMonitorDailyRollup type is an adapter to allow the use of ordinary function as Traverser.
  352. type TraverseChannelMonitorDailyRollup func(context.Context, *ent.ChannelMonitorDailyRollupQuery) error
  353. // Intercept is a dummy implementation of Intercept that returns the next Querier in the pipeline.
  354. func (f TraverseChannelMonitorDailyRollup) Intercept(next ent.Querier) ent.Querier {
  355. return next
  356. }
  357. // Traverse calls f(ctx, q).
  358. func (f TraverseChannelMonitorDailyRollup) Traverse(ctx context.Context, q ent.Query) error {
  359. if q, ok := q.(*ent.ChannelMonitorDailyRollupQuery); ok {
  360. return f(ctx, q)
  361. }
  362. return fmt.Errorf("unexpected query type %T. expect *ent.ChannelMonitorDailyRollupQuery", q)
  363. }
  364. // The ChannelMonitorHistoryFunc type is an adapter to allow the use of ordinary function as a Querier.
  365. type ChannelMonitorHistoryFunc func(context.Context, *ent.ChannelMonitorHistoryQuery) (ent.Value, error)
  366. // Query calls f(ctx, q).
  367. func (f ChannelMonitorHistoryFunc) Query(ctx context.Context, q ent.Query) (ent.Value, error) {
  368. if q, ok := q.(*ent.ChannelMonitorHistoryQuery); ok {
  369. return f(ctx, q)
  370. }
  371. return nil, fmt.Errorf("unexpected query type %T. expect *ent.ChannelMonitorHistoryQuery", q)
  372. }
  373. // The TraverseChannelMonitorHistory type is an adapter to allow the use of ordinary function as Traverser.
  374. type TraverseChannelMonitorHistory func(context.Context, *ent.ChannelMonitorHistoryQuery) error
  375. // Intercept is a dummy implementation of Intercept that returns the next Querier in the pipeline.
  376. func (f TraverseChannelMonitorHistory) Intercept(next ent.Querier) ent.Querier {
  377. return next
  378. }
  379. // Traverse calls f(ctx, q).
  380. func (f TraverseChannelMonitorHistory) Traverse(ctx context.Context, q ent.Query) error {
  381. if q, ok := q.(*ent.ChannelMonitorHistoryQuery); ok {
  382. return f(ctx, q)
  383. }
  384. return fmt.Errorf("unexpected query type %T. expect *ent.ChannelMonitorHistoryQuery", q)
  385. }
  386. // The ChannelMonitorRequestTemplateFunc type is an adapter to allow the use of ordinary function as a Querier.
  387. type ChannelMonitorRequestTemplateFunc func(context.Context, *ent.ChannelMonitorRequestTemplateQuery) (ent.Value, error)
  388. // Query calls f(ctx, q).
  389. func (f ChannelMonitorRequestTemplateFunc) Query(ctx context.Context, q ent.Query) (ent.Value, error) {
  390. if q, ok := q.(*ent.ChannelMonitorRequestTemplateQuery); ok {
  391. return f(ctx, q)
  392. }
  393. return nil, fmt.Errorf("unexpected query type %T. expect *ent.ChannelMonitorRequestTemplateQuery", q)
  394. }
  395. // The TraverseChannelMonitorRequestTemplate type is an adapter to allow the use of ordinary function as Traverser.
  396. type TraverseChannelMonitorRequestTemplate func(context.Context, *ent.ChannelMonitorRequestTemplateQuery) error
  397. // Intercept is a dummy implementation of Intercept that returns the next Querier in the pipeline.
  398. func (f TraverseChannelMonitorRequestTemplate) Intercept(next ent.Querier) ent.Querier {
  399. return next
  400. }
  401. // Traverse calls f(ctx, q).
  402. func (f TraverseChannelMonitorRequestTemplate) Traverse(ctx context.Context, q ent.Query) error {
  403. if q, ok := q.(*ent.ChannelMonitorRequestTemplateQuery); ok {
  404. return f(ctx, q)
  405. }
  406. return fmt.Errorf("unexpected query type %T. expect *ent.ChannelMonitorRequestTemplateQuery", q)
  407. }
  408. // The CompositeModelRouteFunc type is an adapter to allow the use of ordinary function as a Querier.
  409. type CompositeModelRouteFunc func(context.Context, *ent.CompositeModelRouteQuery) (ent.Value, error)
  410. // Query calls f(ctx, q).
  411. func (f CompositeModelRouteFunc) Query(ctx context.Context, q ent.Query) (ent.Value, error) {
  412. if q, ok := q.(*ent.CompositeModelRouteQuery); ok {
  413. return f(ctx, q)
  414. }
  415. return nil, fmt.Errorf("unexpected query type %T. expect *ent.CompositeModelRouteQuery", q)
  416. }
  417. // The TraverseCompositeModelRoute type is an adapter to allow the use of ordinary function as Traverser.
  418. type TraverseCompositeModelRoute func(context.Context, *ent.CompositeModelRouteQuery) error
  419. // Intercept is a dummy implementation of Intercept that returns the next Querier in the pipeline.
  420. func (f TraverseCompositeModelRoute) Intercept(next ent.Querier) ent.Querier {
  421. return next
  422. }
  423. // Traverse calls f(ctx, q).
  424. func (f TraverseCompositeModelRoute) Traverse(ctx context.Context, q ent.Query) error {
  425. if q, ok := q.(*ent.CompositeModelRouteQuery); ok {
  426. return f(ctx, q)
  427. }
  428. return fmt.Errorf("unexpected query type %T. expect *ent.CompositeModelRouteQuery", q)
  429. }
  430. // The ErrorPassthroughRuleFunc type is an adapter to allow the use of ordinary function as a Querier.
  431. type ErrorPassthroughRuleFunc func(context.Context, *ent.ErrorPassthroughRuleQuery) (ent.Value, error)
  432. // Query calls f(ctx, q).
  433. func (f ErrorPassthroughRuleFunc) Query(ctx context.Context, q ent.Query) (ent.Value, error) {
  434. if q, ok := q.(*ent.ErrorPassthroughRuleQuery); ok {
  435. return f(ctx, q)
  436. }
  437. return nil, fmt.Errorf("unexpected query type %T. expect *ent.ErrorPassthroughRuleQuery", q)
  438. }
  439. // The TraverseErrorPassthroughRule type is an adapter to allow the use of ordinary function as Traverser.
  440. type TraverseErrorPassthroughRule func(context.Context, *ent.ErrorPassthroughRuleQuery) error
  441. // Intercept is a dummy implementation of Intercept that returns the next Querier in the pipeline.
  442. func (f TraverseErrorPassthroughRule) Intercept(next ent.Querier) ent.Querier {
  443. return next
  444. }
  445. // Traverse calls f(ctx, q).
  446. func (f TraverseErrorPassthroughRule) Traverse(ctx context.Context, q ent.Query) error {
  447. if q, ok := q.(*ent.ErrorPassthroughRuleQuery); ok {
  448. return f(ctx, q)
  449. }
  450. return fmt.Errorf("unexpected query type %T. expect *ent.ErrorPassthroughRuleQuery", q)
  451. }
  452. // The GroupFunc type is an adapter to allow the use of ordinary function as a Querier.
  453. type GroupFunc func(context.Context, *ent.GroupQuery) (ent.Value, error)
  454. // Query calls f(ctx, q).
  455. func (f GroupFunc) Query(ctx context.Context, q ent.Query) (ent.Value, error) {
  456. if q, ok := q.(*ent.GroupQuery); ok {
  457. return f(ctx, q)
  458. }
  459. return nil, fmt.Errorf("unexpected query type %T. expect *ent.GroupQuery", q)
  460. }
  461. // The TraverseGroup type is an adapter to allow the use of ordinary function as Traverser.
  462. type TraverseGroup func(context.Context, *ent.GroupQuery) error
  463. // Intercept is a dummy implementation of Intercept that returns the next Querier in the pipeline.
  464. func (f TraverseGroup) Intercept(next ent.Querier) ent.Querier {
  465. return next
  466. }
  467. // Traverse calls f(ctx, q).
  468. func (f TraverseGroup) Traverse(ctx context.Context, q ent.Query) error {
  469. if q, ok := q.(*ent.GroupQuery); ok {
  470. return f(ctx, q)
  471. }
  472. return fmt.Errorf("unexpected query type %T. expect *ent.GroupQuery", q)
  473. }
  474. // The IdempotencyRecordFunc type is an adapter to allow the use of ordinary function as a Querier.
  475. type IdempotencyRecordFunc func(context.Context, *ent.IdempotencyRecordQuery) (ent.Value, error)
  476. // Query calls f(ctx, q).
  477. func (f IdempotencyRecordFunc) Query(ctx context.Context, q ent.Query) (ent.Value, error) {
  478. if q, ok := q.(*ent.IdempotencyRecordQuery); ok {
  479. return f(ctx, q)
  480. }
  481. return nil, fmt.Errorf("unexpected query type %T. expect *ent.IdempotencyRecordQuery", q)
  482. }
  483. // The TraverseIdempotencyRecord type is an adapter to allow the use of ordinary function as Traverser.
  484. type TraverseIdempotencyRecord func(context.Context, *ent.IdempotencyRecordQuery) error
  485. // Intercept is a dummy implementation of Intercept that returns the next Querier in the pipeline.
  486. func (f TraverseIdempotencyRecord) Intercept(next ent.Querier) ent.Querier {
  487. return next
  488. }
  489. // Traverse calls f(ctx, q).
  490. func (f TraverseIdempotencyRecord) Traverse(ctx context.Context, q ent.Query) error {
  491. if q, ok := q.(*ent.IdempotencyRecordQuery); ok {
  492. return f(ctx, q)
  493. }
  494. return fmt.Errorf("unexpected query type %T. expect *ent.IdempotencyRecordQuery", q)
  495. }
  496. // The IdentityAdoptionDecisionFunc type is an adapter to allow the use of ordinary function as a Querier.
  497. type IdentityAdoptionDecisionFunc func(context.Context, *ent.IdentityAdoptionDecisionQuery) (ent.Value, error)
  498. // Query calls f(ctx, q).
  499. func (f IdentityAdoptionDecisionFunc) Query(ctx context.Context, q ent.Query) (ent.Value, error) {
  500. if q, ok := q.(*ent.IdentityAdoptionDecisionQuery); ok {
  501. return f(ctx, q)
  502. }
  503. return nil, fmt.Errorf("unexpected query type %T. expect *ent.IdentityAdoptionDecisionQuery", q)
  504. }
  505. // The TraverseIdentityAdoptionDecision type is an adapter to allow the use of ordinary function as Traverser.
  506. type TraverseIdentityAdoptionDecision func(context.Context, *ent.IdentityAdoptionDecisionQuery) error
  507. // Intercept is a dummy implementation of Intercept that returns the next Querier in the pipeline.
  508. func (f TraverseIdentityAdoptionDecision) Intercept(next ent.Querier) ent.Querier {
  509. return next
  510. }
  511. // Traverse calls f(ctx, q).
  512. func (f TraverseIdentityAdoptionDecision) Traverse(ctx context.Context, q ent.Query) error {
  513. if q, ok := q.(*ent.IdentityAdoptionDecisionQuery); ok {
  514. return f(ctx, q)
  515. }
  516. return fmt.Errorf("unexpected query type %T. expect *ent.IdentityAdoptionDecisionQuery", q)
  517. }
  518. // The PaymentAuditLogFunc type is an adapter to allow the use of ordinary function as a Querier.
  519. type PaymentAuditLogFunc func(context.Context, *ent.PaymentAuditLogQuery) (ent.Value, error)
  520. // Query calls f(ctx, q).
  521. func (f PaymentAuditLogFunc) Query(ctx context.Context, q ent.Query) (ent.Value, error) {
  522. if q, ok := q.(*ent.PaymentAuditLogQuery); ok {
  523. return f(ctx, q)
  524. }
  525. return nil, fmt.Errorf("unexpected query type %T. expect *ent.PaymentAuditLogQuery", q)
  526. }
  527. // The TraversePaymentAuditLog type is an adapter to allow the use of ordinary function as Traverser.
  528. type TraversePaymentAuditLog func(context.Context, *ent.PaymentAuditLogQuery) error
  529. // Intercept is a dummy implementation of Intercept that returns the next Querier in the pipeline.
  530. func (f TraversePaymentAuditLog) Intercept(next ent.Querier) ent.Querier {
  531. return next
  532. }
  533. // Traverse calls f(ctx, q).
  534. func (f TraversePaymentAuditLog) Traverse(ctx context.Context, q ent.Query) error {
  535. if q, ok := q.(*ent.PaymentAuditLogQuery); ok {
  536. return f(ctx, q)
  537. }
  538. return fmt.Errorf("unexpected query type %T. expect *ent.PaymentAuditLogQuery", q)
  539. }
  540. // The PaymentOrderFunc type is an adapter to allow the use of ordinary function as a Querier.
  541. type PaymentOrderFunc func(context.Context, *ent.PaymentOrderQuery) (ent.Value, error)
  542. // Query calls f(ctx, q).
  543. func (f PaymentOrderFunc) Query(ctx context.Context, q ent.Query) (ent.Value, error) {
  544. if q, ok := q.(*ent.PaymentOrderQuery); ok {
  545. return f(ctx, q)
  546. }
  547. return nil, fmt.Errorf("unexpected query type %T. expect *ent.PaymentOrderQuery", q)
  548. }
  549. // The TraversePaymentOrder type is an adapter to allow the use of ordinary function as Traverser.
  550. type TraversePaymentOrder func(context.Context, *ent.PaymentOrderQuery) error
  551. // Intercept is a dummy implementation of Intercept that returns the next Querier in the pipeline.
  552. func (f TraversePaymentOrder) Intercept(next ent.Querier) ent.Querier {
  553. return next
  554. }
  555. // Traverse calls f(ctx, q).
  556. func (f TraversePaymentOrder) Traverse(ctx context.Context, q ent.Query) error {
  557. if q, ok := q.(*ent.PaymentOrderQuery); ok {
  558. return f(ctx, q)
  559. }
  560. return fmt.Errorf("unexpected query type %T. expect *ent.PaymentOrderQuery", q)
  561. }
  562. // The PaymentProviderInstanceFunc type is an adapter to allow the use of ordinary function as a Querier.
  563. type PaymentProviderInstanceFunc func(context.Context, *ent.PaymentProviderInstanceQuery) (ent.Value, error)
  564. // Query calls f(ctx, q).
  565. func (f PaymentProviderInstanceFunc) Query(ctx context.Context, q ent.Query) (ent.Value, error) {
  566. if q, ok := q.(*ent.PaymentProviderInstanceQuery); ok {
  567. return f(ctx, q)
  568. }
  569. return nil, fmt.Errorf("unexpected query type %T. expect *ent.PaymentProviderInstanceQuery", q)
  570. }
  571. // The TraversePaymentProviderInstance type is an adapter to allow the use of ordinary function as Traverser.
  572. type TraversePaymentProviderInstance func(context.Context, *ent.PaymentProviderInstanceQuery) error
  573. // Intercept is a dummy implementation of Intercept that returns the next Querier in the pipeline.
  574. func (f TraversePaymentProviderInstance) Intercept(next ent.Querier) ent.Querier {
  575. return next
  576. }
  577. // Traverse calls f(ctx, q).
  578. func (f TraversePaymentProviderInstance) Traverse(ctx context.Context, q ent.Query) error {
  579. if q, ok := q.(*ent.PaymentProviderInstanceQuery); ok {
  580. return f(ctx, q)
  581. }
  582. return fmt.Errorf("unexpected query type %T. expect *ent.PaymentProviderInstanceQuery", q)
  583. }
  584. // The PendingAuthSessionFunc type is an adapter to allow the use of ordinary function as a Querier.
  585. type PendingAuthSessionFunc func(context.Context, *ent.PendingAuthSessionQuery) (ent.Value, error)
  586. // Query calls f(ctx, q).
  587. func (f PendingAuthSessionFunc) Query(ctx context.Context, q ent.Query) (ent.Value, error) {
  588. if q, ok := q.(*ent.PendingAuthSessionQuery); ok {
  589. return f(ctx, q)
  590. }
  591. return nil, fmt.Errorf("unexpected query type %T. expect *ent.PendingAuthSessionQuery", q)
  592. }
  593. // The TraversePendingAuthSession type is an adapter to allow the use of ordinary function as Traverser.
  594. type TraversePendingAuthSession func(context.Context, *ent.PendingAuthSessionQuery) error
  595. // Intercept is a dummy implementation of Intercept that returns the next Querier in the pipeline.
  596. func (f TraversePendingAuthSession) Intercept(next ent.Querier) ent.Querier {
  597. return next
  598. }
  599. // Traverse calls f(ctx, q).
  600. func (f TraversePendingAuthSession) Traverse(ctx context.Context, q ent.Query) error {
  601. if q, ok := q.(*ent.PendingAuthSessionQuery); ok {
  602. return f(ctx, q)
  603. }
  604. return fmt.Errorf("unexpected query type %T. expect *ent.PendingAuthSessionQuery", q)
  605. }
  606. // The PromoCodeFunc type is an adapter to allow the use of ordinary function as a Querier.
  607. type PromoCodeFunc func(context.Context, *ent.PromoCodeQuery) (ent.Value, error)
  608. // Query calls f(ctx, q).
  609. func (f PromoCodeFunc) Query(ctx context.Context, q ent.Query) (ent.Value, error) {
  610. if q, ok := q.(*ent.PromoCodeQuery); ok {
  611. return f(ctx, q)
  612. }
  613. return nil, fmt.Errorf("unexpected query type %T. expect *ent.PromoCodeQuery", q)
  614. }
  615. // The TraversePromoCode type is an adapter to allow the use of ordinary function as Traverser.
  616. type TraversePromoCode func(context.Context, *ent.PromoCodeQuery) error
  617. // Intercept is a dummy implementation of Intercept that returns the next Querier in the pipeline.
  618. func (f TraversePromoCode) Intercept(next ent.Querier) ent.Querier {
  619. return next
  620. }
  621. // Traverse calls f(ctx, q).
  622. func (f TraversePromoCode) Traverse(ctx context.Context, q ent.Query) error {
  623. if q, ok := q.(*ent.PromoCodeQuery); ok {
  624. return f(ctx, q)
  625. }
  626. return fmt.Errorf("unexpected query type %T. expect *ent.PromoCodeQuery", q)
  627. }
  628. // The PromoCodeUsageFunc type is an adapter to allow the use of ordinary function as a Querier.
  629. type PromoCodeUsageFunc func(context.Context, *ent.PromoCodeUsageQuery) (ent.Value, error)
  630. // Query calls f(ctx, q).
  631. func (f PromoCodeUsageFunc) Query(ctx context.Context, q ent.Query) (ent.Value, error) {
  632. if q, ok := q.(*ent.PromoCodeUsageQuery); ok {
  633. return f(ctx, q)
  634. }
  635. return nil, fmt.Errorf("unexpected query type %T. expect *ent.PromoCodeUsageQuery", q)
  636. }
  637. // The TraversePromoCodeUsage type is an adapter to allow the use of ordinary function as Traverser.
  638. type TraversePromoCodeUsage func(context.Context, *ent.PromoCodeUsageQuery) error
  639. // Intercept is a dummy implementation of Intercept that returns the next Querier in the pipeline.
  640. func (f TraversePromoCodeUsage) Intercept(next ent.Querier) ent.Querier {
  641. return next
  642. }
  643. // Traverse calls f(ctx, q).
  644. func (f TraversePromoCodeUsage) Traverse(ctx context.Context, q ent.Query) error {
  645. if q, ok := q.(*ent.PromoCodeUsageQuery); ok {
  646. return f(ctx, q)
  647. }
  648. return fmt.Errorf("unexpected query type %T. expect *ent.PromoCodeUsageQuery", q)
  649. }
  650. // The ProxyFunc type is an adapter to allow the use of ordinary function as a Querier.
  651. type ProxyFunc func(context.Context, *ent.ProxyQuery) (ent.Value, error)
  652. // Query calls f(ctx, q).
  653. func (f ProxyFunc) Query(ctx context.Context, q ent.Query) (ent.Value, error) {
  654. if q, ok := q.(*ent.ProxyQuery); ok {
  655. return f(ctx, q)
  656. }
  657. return nil, fmt.Errorf("unexpected query type %T. expect *ent.ProxyQuery", q)
  658. }
  659. // The TraverseProxy type is an adapter to allow the use of ordinary function as Traverser.
  660. type TraverseProxy func(context.Context, *ent.ProxyQuery) error
  661. // Intercept is a dummy implementation of Intercept that returns the next Querier in the pipeline.
  662. func (f TraverseProxy) Intercept(next ent.Querier) ent.Querier {
  663. return next
  664. }
  665. // Traverse calls f(ctx, q).
  666. func (f TraverseProxy) Traverse(ctx context.Context, q ent.Query) error {
  667. if q, ok := q.(*ent.ProxyQuery); ok {
  668. return f(ctx, q)
  669. }
  670. return fmt.Errorf("unexpected query type %T. expect *ent.ProxyQuery", q)
  671. }
  672. // The RedeemCodeFunc type is an adapter to allow the use of ordinary function as a Querier.
  673. type RedeemCodeFunc func(context.Context, *ent.RedeemCodeQuery) (ent.Value, error)
  674. // Query calls f(ctx, q).
  675. func (f RedeemCodeFunc) Query(ctx context.Context, q ent.Query) (ent.Value, error) {
  676. if q, ok := q.(*ent.RedeemCodeQuery); ok {
  677. return f(ctx, q)
  678. }
  679. return nil, fmt.Errorf("unexpected query type %T. expect *ent.RedeemCodeQuery", q)
  680. }
  681. // The TraverseRedeemCode type is an adapter to allow the use of ordinary function as Traverser.
  682. type TraverseRedeemCode func(context.Context, *ent.RedeemCodeQuery) error
  683. // Intercept is a dummy implementation of Intercept that returns the next Querier in the pipeline.
  684. func (f TraverseRedeemCode) Intercept(next ent.Querier) ent.Querier {
  685. return next
  686. }
  687. // Traverse calls f(ctx, q).
  688. func (f TraverseRedeemCode) Traverse(ctx context.Context, q ent.Query) error {
  689. if q, ok := q.(*ent.RedeemCodeQuery); ok {
  690. return f(ctx, q)
  691. }
  692. return fmt.Errorf("unexpected query type %T. expect *ent.RedeemCodeQuery", q)
  693. }
  694. // The SecurityPolicyKeywordFunc type is an adapter to allow the use of ordinary function as a Querier.
  695. type SecurityPolicyKeywordFunc func(context.Context, *ent.SecurityPolicyKeywordQuery) (ent.Value, error)
  696. // Query calls f(ctx, q).
  697. func (f SecurityPolicyKeywordFunc) Query(ctx context.Context, q ent.Query) (ent.Value, error) {
  698. if q, ok := q.(*ent.SecurityPolicyKeywordQuery); ok {
  699. return f(ctx, q)
  700. }
  701. return nil, fmt.Errorf("unexpected query type %T. expect *ent.SecurityPolicyKeywordQuery", q)
  702. }
  703. // The TraverseSecurityPolicyKeyword type is an adapter to allow the use of ordinary function as Traverser.
  704. type TraverseSecurityPolicyKeyword func(context.Context, *ent.SecurityPolicyKeywordQuery) error
  705. // Intercept is a dummy implementation of Intercept that returns the next Querier in the pipeline.
  706. func (f TraverseSecurityPolicyKeyword) Intercept(next ent.Querier) ent.Querier {
  707. return next
  708. }
  709. // Traverse calls f(ctx, q).
  710. func (f TraverseSecurityPolicyKeyword) Traverse(ctx context.Context, q ent.Query) error {
  711. if q, ok := q.(*ent.SecurityPolicyKeywordQuery); ok {
  712. return f(ctx, q)
  713. }
  714. return fmt.Errorf("unexpected query type %T. expect *ent.SecurityPolicyKeywordQuery", q)
  715. }
  716. // The SecuritySecretFunc type is an adapter to allow the use of ordinary function as a Querier.
  717. type SecuritySecretFunc func(context.Context, *ent.SecuritySecretQuery) (ent.Value, error)
  718. // Query calls f(ctx, q).
  719. func (f SecuritySecretFunc) Query(ctx context.Context, q ent.Query) (ent.Value, error) {
  720. if q, ok := q.(*ent.SecuritySecretQuery); ok {
  721. return f(ctx, q)
  722. }
  723. return nil, fmt.Errorf("unexpected query type %T. expect *ent.SecuritySecretQuery", q)
  724. }
  725. // The TraverseSecuritySecret type is an adapter to allow the use of ordinary function as Traverser.
  726. type TraverseSecuritySecret func(context.Context, *ent.SecuritySecretQuery) error
  727. // Intercept is a dummy implementation of Intercept that returns the next Querier in the pipeline.
  728. func (f TraverseSecuritySecret) Intercept(next ent.Querier) ent.Querier {
  729. return next
  730. }
  731. // Traverse calls f(ctx, q).
  732. func (f TraverseSecuritySecret) Traverse(ctx context.Context, q ent.Query) error {
  733. if q, ok := q.(*ent.SecuritySecretQuery); ok {
  734. return f(ctx, q)
  735. }
  736. return fmt.Errorf("unexpected query type %T. expect *ent.SecuritySecretQuery", q)
  737. }
  738. // The SettingFunc type is an adapter to allow the use of ordinary function as a Querier.
  739. type SettingFunc func(context.Context, *ent.SettingQuery) (ent.Value, error)
  740. // Query calls f(ctx, q).
  741. func (f SettingFunc) Query(ctx context.Context, q ent.Query) (ent.Value, error) {
  742. if q, ok := q.(*ent.SettingQuery); ok {
  743. return f(ctx, q)
  744. }
  745. return nil, fmt.Errorf("unexpected query type %T. expect *ent.SettingQuery", q)
  746. }
  747. // The TraverseSetting type is an adapter to allow the use of ordinary function as Traverser.
  748. type TraverseSetting func(context.Context, *ent.SettingQuery) error
  749. // Intercept is a dummy implementation of Intercept that returns the next Querier in the pipeline.
  750. func (f TraverseSetting) Intercept(next ent.Querier) ent.Querier {
  751. return next
  752. }
  753. // Traverse calls f(ctx, q).
  754. func (f TraverseSetting) Traverse(ctx context.Context, q ent.Query) error {
  755. if q, ok := q.(*ent.SettingQuery); ok {
  756. return f(ctx, q)
  757. }
  758. return fmt.Errorf("unexpected query type %T. expect *ent.SettingQuery", q)
  759. }
  760. // The SubscriptionPlanFunc type is an adapter to allow the use of ordinary function as a Querier.
  761. type SubscriptionPlanFunc func(context.Context, *ent.SubscriptionPlanQuery) (ent.Value, error)
  762. // Query calls f(ctx, q).
  763. func (f SubscriptionPlanFunc) Query(ctx context.Context, q ent.Query) (ent.Value, error) {
  764. if q, ok := q.(*ent.SubscriptionPlanQuery); ok {
  765. return f(ctx, q)
  766. }
  767. return nil, fmt.Errorf("unexpected query type %T. expect *ent.SubscriptionPlanQuery", q)
  768. }
  769. // The TraverseSubscriptionPlan type is an adapter to allow the use of ordinary function as Traverser.
  770. type TraverseSubscriptionPlan func(context.Context, *ent.SubscriptionPlanQuery) error
  771. // Intercept is a dummy implementation of Intercept that returns the next Querier in the pipeline.
  772. func (f TraverseSubscriptionPlan) Intercept(next ent.Querier) ent.Querier {
  773. return next
  774. }
  775. // Traverse calls f(ctx, q).
  776. func (f TraverseSubscriptionPlan) Traverse(ctx context.Context, q ent.Query) error {
  777. if q, ok := q.(*ent.SubscriptionPlanQuery); ok {
  778. return f(ctx, q)
  779. }
  780. return fmt.Errorf("unexpected query type %T. expect *ent.SubscriptionPlanQuery", q)
  781. }
  782. // The TLSFingerprintProfileFunc type is an adapter to allow the use of ordinary function as a Querier.
  783. type TLSFingerprintProfileFunc func(context.Context, *ent.TLSFingerprintProfileQuery) (ent.Value, error)
  784. // Query calls f(ctx, q).
  785. func (f TLSFingerprintProfileFunc) Query(ctx context.Context, q ent.Query) (ent.Value, error) {
  786. if q, ok := q.(*ent.TLSFingerprintProfileQuery); ok {
  787. return f(ctx, q)
  788. }
  789. return nil, fmt.Errorf("unexpected query type %T. expect *ent.TLSFingerprintProfileQuery", q)
  790. }
  791. // The TraverseTLSFingerprintProfile type is an adapter to allow the use of ordinary function as Traverser.
  792. type TraverseTLSFingerprintProfile func(context.Context, *ent.TLSFingerprintProfileQuery) error
  793. // Intercept is a dummy implementation of Intercept that returns the next Querier in the pipeline.
  794. func (f TraverseTLSFingerprintProfile) Intercept(next ent.Querier) ent.Querier {
  795. return next
  796. }
  797. // Traverse calls f(ctx, q).
  798. func (f TraverseTLSFingerprintProfile) Traverse(ctx context.Context, q ent.Query) error {
  799. if q, ok := q.(*ent.TLSFingerprintProfileQuery); ok {
  800. return f(ctx, q)
  801. }
  802. return fmt.Errorf("unexpected query type %T. expect *ent.TLSFingerprintProfileQuery", q)
  803. }
  804. // The UsageCleanupTaskFunc type is an adapter to allow the use of ordinary function as a Querier.
  805. type UsageCleanupTaskFunc func(context.Context, *ent.UsageCleanupTaskQuery) (ent.Value, error)
  806. // Query calls f(ctx, q).
  807. func (f UsageCleanupTaskFunc) Query(ctx context.Context, q ent.Query) (ent.Value, error) {
  808. if q, ok := q.(*ent.UsageCleanupTaskQuery); ok {
  809. return f(ctx, q)
  810. }
  811. return nil, fmt.Errorf("unexpected query type %T. expect *ent.UsageCleanupTaskQuery", q)
  812. }
  813. // The TraverseUsageCleanupTask type is an adapter to allow the use of ordinary function as Traverser.
  814. type TraverseUsageCleanupTask func(context.Context, *ent.UsageCleanupTaskQuery) error
  815. // Intercept is a dummy implementation of Intercept that returns the next Querier in the pipeline.
  816. func (f TraverseUsageCleanupTask) Intercept(next ent.Querier) ent.Querier {
  817. return next
  818. }
  819. // Traverse calls f(ctx, q).
  820. func (f TraverseUsageCleanupTask) Traverse(ctx context.Context, q ent.Query) error {
  821. if q, ok := q.(*ent.UsageCleanupTaskQuery); ok {
  822. return f(ctx, q)
  823. }
  824. return fmt.Errorf("unexpected query type %T. expect *ent.UsageCleanupTaskQuery", q)
  825. }
  826. // The UsageLogFunc type is an adapter to allow the use of ordinary function as a Querier.
  827. type UsageLogFunc func(context.Context, *ent.UsageLogQuery) (ent.Value, error)
  828. // Query calls f(ctx, q).
  829. func (f UsageLogFunc) Query(ctx context.Context, q ent.Query) (ent.Value, error) {
  830. if q, ok := q.(*ent.UsageLogQuery); ok {
  831. return f(ctx, q)
  832. }
  833. return nil, fmt.Errorf("unexpected query type %T. expect *ent.UsageLogQuery", q)
  834. }
  835. // The TraverseUsageLog type is an adapter to allow the use of ordinary function as Traverser.
  836. type TraverseUsageLog func(context.Context, *ent.UsageLogQuery) error
  837. // Intercept is a dummy implementation of Intercept that returns the next Querier in the pipeline.
  838. func (f TraverseUsageLog) Intercept(next ent.Querier) ent.Querier {
  839. return next
  840. }
  841. // Traverse calls f(ctx, q).
  842. func (f TraverseUsageLog) Traverse(ctx context.Context, q ent.Query) error {
  843. if q, ok := q.(*ent.UsageLogQuery); ok {
  844. return f(ctx, q)
  845. }
  846. return fmt.Errorf("unexpected query type %T. expect *ent.UsageLogQuery", q)
  847. }
  848. // The UserFunc type is an adapter to allow the use of ordinary function as a Querier.
  849. type UserFunc func(context.Context, *ent.UserQuery) (ent.Value, error)
  850. // Query calls f(ctx, q).
  851. func (f UserFunc) Query(ctx context.Context, q ent.Query) (ent.Value, error) {
  852. if q, ok := q.(*ent.UserQuery); ok {
  853. return f(ctx, q)
  854. }
  855. return nil, fmt.Errorf("unexpected query type %T. expect *ent.UserQuery", q)
  856. }
  857. // The TraverseUser type is an adapter to allow the use of ordinary function as Traverser.
  858. type TraverseUser func(context.Context, *ent.UserQuery) error
  859. // Intercept is a dummy implementation of Intercept that returns the next Querier in the pipeline.
  860. func (f TraverseUser) Intercept(next ent.Querier) ent.Querier {
  861. return next
  862. }
  863. // Traverse calls f(ctx, q).
  864. func (f TraverseUser) Traverse(ctx context.Context, q ent.Query) error {
  865. if q, ok := q.(*ent.UserQuery); ok {
  866. return f(ctx, q)
  867. }
  868. return fmt.Errorf("unexpected query type %T. expect *ent.UserQuery", q)
  869. }
  870. // The UserAllowedGroupFunc type is an adapter to allow the use of ordinary function as a Querier.
  871. type UserAllowedGroupFunc func(context.Context, *ent.UserAllowedGroupQuery) (ent.Value, error)
  872. // Query calls f(ctx, q).
  873. func (f UserAllowedGroupFunc) Query(ctx context.Context, q ent.Query) (ent.Value, error) {
  874. if q, ok := q.(*ent.UserAllowedGroupQuery); ok {
  875. return f(ctx, q)
  876. }
  877. return nil, fmt.Errorf("unexpected query type %T. expect *ent.UserAllowedGroupQuery", q)
  878. }
  879. // The TraverseUserAllowedGroup type is an adapter to allow the use of ordinary function as Traverser.
  880. type TraverseUserAllowedGroup func(context.Context, *ent.UserAllowedGroupQuery) error
  881. // Intercept is a dummy implementation of Intercept that returns the next Querier in the pipeline.
  882. func (f TraverseUserAllowedGroup) Intercept(next ent.Querier) ent.Querier {
  883. return next
  884. }
  885. // Traverse calls f(ctx, q).
  886. func (f TraverseUserAllowedGroup) Traverse(ctx context.Context, q ent.Query) error {
  887. if q, ok := q.(*ent.UserAllowedGroupQuery); ok {
  888. return f(ctx, q)
  889. }
  890. return fmt.Errorf("unexpected query type %T. expect *ent.UserAllowedGroupQuery", q)
  891. }
  892. // The UserAttributeDefinitionFunc type is an adapter to allow the use of ordinary function as a Querier.
  893. type UserAttributeDefinitionFunc func(context.Context, *ent.UserAttributeDefinitionQuery) (ent.Value, error)
  894. // Query calls f(ctx, q).
  895. func (f UserAttributeDefinitionFunc) Query(ctx context.Context, q ent.Query) (ent.Value, error) {
  896. if q, ok := q.(*ent.UserAttributeDefinitionQuery); ok {
  897. return f(ctx, q)
  898. }
  899. return nil, fmt.Errorf("unexpected query type %T. expect *ent.UserAttributeDefinitionQuery", q)
  900. }
  901. // The TraverseUserAttributeDefinition type is an adapter to allow the use of ordinary function as Traverser.
  902. type TraverseUserAttributeDefinition func(context.Context, *ent.UserAttributeDefinitionQuery) error
  903. // Intercept is a dummy implementation of Intercept that returns the next Querier in the pipeline.
  904. func (f TraverseUserAttributeDefinition) Intercept(next ent.Querier) ent.Querier {
  905. return next
  906. }
  907. // Traverse calls f(ctx, q).
  908. func (f TraverseUserAttributeDefinition) Traverse(ctx context.Context, q ent.Query) error {
  909. if q, ok := q.(*ent.UserAttributeDefinitionQuery); ok {
  910. return f(ctx, q)
  911. }
  912. return fmt.Errorf("unexpected query type %T. expect *ent.UserAttributeDefinitionQuery", q)
  913. }
  914. // The UserAttributeValueFunc type is an adapter to allow the use of ordinary function as a Querier.
  915. type UserAttributeValueFunc func(context.Context, *ent.UserAttributeValueQuery) (ent.Value, error)
  916. // Query calls f(ctx, q).
  917. func (f UserAttributeValueFunc) Query(ctx context.Context, q ent.Query) (ent.Value, error) {
  918. if q, ok := q.(*ent.UserAttributeValueQuery); ok {
  919. return f(ctx, q)
  920. }
  921. return nil, fmt.Errorf("unexpected query type %T. expect *ent.UserAttributeValueQuery", q)
  922. }
  923. // The TraverseUserAttributeValue type is an adapter to allow the use of ordinary function as Traverser.
  924. type TraverseUserAttributeValue func(context.Context, *ent.UserAttributeValueQuery) error
  925. // Intercept is a dummy implementation of Intercept that returns the next Querier in the pipeline.
  926. func (f TraverseUserAttributeValue) Intercept(next ent.Querier) ent.Querier {
  927. return next
  928. }
  929. // Traverse calls f(ctx, q).
  930. func (f TraverseUserAttributeValue) Traverse(ctx context.Context, q ent.Query) error {
  931. if q, ok := q.(*ent.UserAttributeValueQuery); ok {
  932. return f(ctx, q)
  933. }
  934. return fmt.Errorf("unexpected query type %T. expect *ent.UserAttributeValueQuery", q)
  935. }
  936. // The UserPlatformQuotaFunc type is an adapter to allow the use of ordinary function as a Querier.
  937. type UserPlatformQuotaFunc func(context.Context, *ent.UserPlatformQuotaQuery) (ent.Value, error)
  938. // Query calls f(ctx, q).
  939. func (f UserPlatformQuotaFunc) Query(ctx context.Context, q ent.Query) (ent.Value, error) {
  940. if q, ok := q.(*ent.UserPlatformQuotaQuery); ok {
  941. return f(ctx, q)
  942. }
  943. return nil, fmt.Errorf("unexpected query type %T. expect *ent.UserPlatformQuotaQuery", q)
  944. }
  945. // The TraverseUserPlatformQuota type is an adapter to allow the use of ordinary function as Traverser.
  946. type TraverseUserPlatformQuota func(context.Context, *ent.UserPlatformQuotaQuery) error
  947. // Intercept is a dummy implementation of Intercept that returns the next Querier in the pipeline.
  948. func (f TraverseUserPlatformQuota) Intercept(next ent.Querier) ent.Querier {
  949. return next
  950. }
  951. // Traverse calls f(ctx, q).
  952. func (f TraverseUserPlatformQuota) Traverse(ctx context.Context, q ent.Query) error {
  953. if q, ok := q.(*ent.UserPlatformQuotaQuery); ok {
  954. return f(ctx, q)
  955. }
  956. return fmt.Errorf("unexpected query type %T. expect *ent.UserPlatformQuotaQuery", q)
  957. }
  958. // The UserSubscriptionFunc type is an adapter to allow the use of ordinary function as a Querier.
  959. type UserSubscriptionFunc func(context.Context, *ent.UserSubscriptionQuery) (ent.Value, error)
  960. // Query calls f(ctx, q).
  961. func (f UserSubscriptionFunc) Query(ctx context.Context, q ent.Query) (ent.Value, error) {
  962. if q, ok := q.(*ent.UserSubscriptionQuery); ok {
  963. return f(ctx, q)
  964. }
  965. return nil, fmt.Errorf("unexpected query type %T. expect *ent.UserSubscriptionQuery", q)
  966. }
  967. // The TraverseUserSubscription type is an adapter to allow the use of ordinary function as Traverser.
  968. type TraverseUserSubscription func(context.Context, *ent.UserSubscriptionQuery) error
  969. // Intercept is a dummy implementation of Intercept that returns the next Querier in the pipeline.
  970. func (f TraverseUserSubscription) Intercept(next ent.Querier) ent.Querier {
  971. return next
  972. }
  973. // Traverse calls f(ctx, q).
  974. func (f TraverseUserSubscription) Traverse(ctx context.Context, q ent.Query) error {
  975. if q, ok := q.(*ent.UserSubscriptionQuery); ok {
  976. return f(ctx, q)
  977. }
  978. return fmt.Errorf("unexpected query type %T. expect *ent.UserSubscriptionQuery", 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.APIKeyQuery:
  984. return &query[*ent.APIKeyQuery, predicate.APIKey, apikey.OrderOption]{typ: ent.TypeAPIKey, tq: q}, nil
  985. case *ent.AccountQuery:
  986. return &query[*ent.AccountQuery, predicate.Account, account.OrderOption]{typ: ent.TypeAccount, tq: q}, nil
  987. case *ent.AccountGroupQuery:
  988. return &query[*ent.AccountGroupQuery, predicate.AccountGroup, accountgroup.OrderOption]{typ: ent.TypeAccountGroup, tq: q}, nil
  989. case *ent.AnnouncementQuery:
  990. return &query[*ent.AnnouncementQuery, predicate.Announcement, announcement.OrderOption]{typ: ent.TypeAnnouncement, tq: q}, nil
  991. case *ent.AnnouncementReadQuery:
  992. return &query[*ent.AnnouncementReadQuery, predicate.AnnouncementRead, announcementread.OrderOption]{typ: ent.TypeAnnouncementRead, tq: q}, nil
  993. case *ent.AuthIdentityQuery:
  994. return &query[*ent.AuthIdentityQuery, predicate.AuthIdentity, authidentity.OrderOption]{typ: ent.TypeAuthIdentity, tq: q}, nil
  995. case *ent.AuthIdentityChannelQuery:
  996. return &query[*ent.AuthIdentityChannelQuery, predicate.AuthIdentityChannel, authidentitychannel.OrderOption]{typ: ent.TypeAuthIdentityChannel, tq: q}, nil
  997. case *ent.BatchImageEventQuery:
  998. return &query[*ent.BatchImageEventQuery, predicate.BatchImageEvent, batchimageevent.OrderOption]{typ: ent.TypeBatchImageEvent, tq: q}, nil
  999. case *ent.BatchImageItemQuery:
  1000. return &query[*ent.BatchImageItemQuery, predicate.BatchImageItem, batchimageitem.OrderOption]{typ: ent.TypeBatchImageItem, tq: q}, nil
  1001. case *ent.BatchImageJobQuery:
  1002. return &query[*ent.BatchImageJobQuery, predicate.BatchImageJob, batchimagejob.OrderOption]{typ: ent.TypeBatchImageJob, tq: q}, nil
  1003. case *ent.ChannelMonitorQuery:
  1004. return &query[*ent.ChannelMonitorQuery, predicate.ChannelMonitor, channelmonitor.OrderOption]{typ: ent.TypeChannelMonitor, tq: q}, nil
  1005. case *ent.ChannelMonitorDailyRollupQuery:
  1006. return &query[*ent.ChannelMonitorDailyRollupQuery, predicate.ChannelMonitorDailyRollup, channelmonitordailyrollup.OrderOption]{typ: ent.TypeChannelMonitorDailyRollup, tq: q}, nil
  1007. case *ent.ChannelMonitorHistoryQuery:
  1008. return &query[*ent.ChannelMonitorHistoryQuery, predicate.ChannelMonitorHistory, channelmonitorhistory.OrderOption]{typ: ent.TypeChannelMonitorHistory, tq: q}, nil
  1009. case *ent.ChannelMonitorRequestTemplateQuery:
  1010. return &query[*ent.ChannelMonitorRequestTemplateQuery, predicate.ChannelMonitorRequestTemplate, channelmonitorrequesttemplate.OrderOption]{typ: ent.TypeChannelMonitorRequestTemplate, tq: q}, nil
  1011. case *ent.CompositeModelRouteQuery:
  1012. return &query[*ent.CompositeModelRouteQuery, predicate.CompositeModelRoute, compositemodelroute.OrderOption]{typ: ent.TypeCompositeModelRoute, tq: q}, nil
  1013. case *ent.ErrorPassthroughRuleQuery:
  1014. return &query[*ent.ErrorPassthroughRuleQuery, predicate.ErrorPassthroughRule, errorpassthroughrule.OrderOption]{typ: ent.TypeErrorPassthroughRule, tq: q}, nil
  1015. case *ent.GroupQuery:
  1016. return &query[*ent.GroupQuery, predicate.Group, group.OrderOption]{typ: ent.TypeGroup, tq: q}, nil
  1017. case *ent.IdempotencyRecordQuery:
  1018. return &query[*ent.IdempotencyRecordQuery, predicate.IdempotencyRecord, idempotencyrecord.OrderOption]{typ: ent.TypeIdempotencyRecord, tq: q}, nil
  1019. case *ent.IdentityAdoptionDecisionQuery:
  1020. return &query[*ent.IdentityAdoptionDecisionQuery, predicate.IdentityAdoptionDecision, identityadoptiondecision.OrderOption]{typ: ent.TypeIdentityAdoptionDecision, tq: q}, nil
  1021. case *ent.PaymentAuditLogQuery:
  1022. return &query[*ent.PaymentAuditLogQuery, predicate.PaymentAuditLog, paymentauditlog.OrderOption]{typ: ent.TypePaymentAuditLog, tq: q}, nil
  1023. case *ent.PaymentOrderQuery:
  1024. return &query[*ent.PaymentOrderQuery, predicate.PaymentOrder, paymentorder.OrderOption]{typ: ent.TypePaymentOrder, tq: q}, nil
  1025. case *ent.PaymentProviderInstanceQuery:
  1026. return &query[*ent.PaymentProviderInstanceQuery, predicate.PaymentProviderInstance, paymentproviderinstance.OrderOption]{typ: ent.TypePaymentProviderInstance, tq: q}, nil
  1027. case *ent.PendingAuthSessionQuery:
  1028. return &query[*ent.PendingAuthSessionQuery, predicate.PendingAuthSession, pendingauthsession.OrderOption]{typ: ent.TypePendingAuthSession, tq: q}, nil
  1029. case *ent.PromoCodeQuery:
  1030. return &query[*ent.PromoCodeQuery, predicate.PromoCode, promocode.OrderOption]{typ: ent.TypePromoCode, tq: q}, nil
  1031. case *ent.PromoCodeUsageQuery:
  1032. return &query[*ent.PromoCodeUsageQuery, predicate.PromoCodeUsage, promocodeusage.OrderOption]{typ: ent.TypePromoCodeUsage, tq: q}, nil
  1033. case *ent.ProxyQuery:
  1034. return &query[*ent.ProxyQuery, predicate.Proxy, proxy.OrderOption]{typ: ent.TypeProxy, tq: q}, nil
  1035. case *ent.RedeemCodeQuery:
  1036. return &query[*ent.RedeemCodeQuery, predicate.RedeemCode, redeemcode.OrderOption]{typ: ent.TypeRedeemCode, tq: q}, nil
  1037. case *ent.SecurityPolicyKeywordQuery:
  1038. return &query[*ent.SecurityPolicyKeywordQuery, predicate.SecurityPolicyKeyword, securitypolicykeyword.OrderOption]{typ: ent.TypeSecurityPolicyKeyword, tq: q}, nil
  1039. case *ent.SecuritySecretQuery:
  1040. return &query[*ent.SecuritySecretQuery, predicate.SecuritySecret, securitysecret.OrderOption]{typ: ent.TypeSecuritySecret, tq: q}, nil
  1041. case *ent.SettingQuery:
  1042. return &query[*ent.SettingQuery, predicate.Setting, setting.OrderOption]{typ: ent.TypeSetting, tq: q}, nil
  1043. case *ent.SubscriptionPlanQuery:
  1044. return &query[*ent.SubscriptionPlanQuery, predicate.SubscriptionPlan, subscriptionplan.OrderOption]{typ: ent.TypeSubscriptionPlan, tq: q}, nil
  1045. case *ent.TLSFingerprintProfileQuery:
  1046. return &query[*ent.TLSFingerprintProfileQuery, predicate.TLSFingerprintProfile, tlsfingerprintprofile.OrderOption]{typ: ent.TypeTLSFingerprintProfile, tq: q}, nil
  1047. case *ent.UsageCleanupTaskQuery:
  1048. return &query[*ent.UsageCleanupTaskQuery, predicate.UsageCleanupTask, usagecleanuptask.OrderOption]{typ: ent.TypeUsageCleanupTask, tq: q}, nil
  1049. case *ent.UsageLogQuery:
  1050. return &query[*ent.UsageLogQuery, predicate.UsageLog, usagelog.OrderOption]{typ: ent.TypeUsageLog, tq: q}, nil
  1051. case *ent.UserQuery:
  1052. return &query[*ent.UserQuery, predicate.User, user.OrderOption]{typ: ent.TypeUser, tq: q}, nil
  1053. case *ent.UserAllowedGroupQuery:
  1054. return &query[*ent.UserAllowedGroupQuery, predicate.UserAllowedGroup, userallowedgroup.OrderOption]{typ: ent.TypeUserAllowedGroup, tq: q}, nil
  1055. case *ent.UserAttributeDefinitionQuery:
  1056. return &query[*ent.UserAttributeDefinitionQuery, predicate.UserAttributeDefinition, userattributedefinition.OrderOption]{typ: ent.TypeUserAttributeDefinition, tq: q}, nil
  1057. case *ent.UserAttributeValueQuery:
  1058. return &query[*ent.UserAttributeValueQuery, predicate.UserAttributeValue, userattributevalue.OrderOption]{typ: ent.TypeUserAttributeValue, tq: q}, nil
  1059. case *ent.UserPlatformQuotaQuery:
  1060. return &query[*ent.UserPlatformQuotaQuery, predicate.UserPlatformQuota, userplatformquota.OrderOption]{typ: ent.TypeUserPlatformQuota, tq: q}, nil
  1061. case *ent.UserSubscriptionQuery:
  1062. return &query[*ent.UserSubscriptionQuery, predicate.UserSubscription, usersubscription.OrderOption]{typ: ent.TypeUserSubscription, 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. }