intercept.go 36 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959
  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/batchmsg"
  11. "wechat-api/ent/category"
  12. "wechat-api/ent/chatrecords"
  13. "wechat-api/ent/chatsession"
  14. "wechat-api/ent/contact"
  15. "wechat-api/ent/employee"
  16. "wechat-api/ent/employeeconfig"
  17. "wechat-api/ent/label"
  18. "wechat-api/ent/labelrelationship"
  19. "wechat-api/ent/message"
  20. "wechat-api/ent/messagerecords"
  21. "wechat-api/ent/msg"
  22. "wechat-api/ent/predicate"
  23. "wechat-api/ent/server"
  24. "wechat-api/ent/sopnode"
  25. "wechat-api/ent/sopstage"
  26. "wechat-api/ent/soptask"
  27. "wechat-api/ent/token"
  28. "wechat-api/ent/tutorial"
  29. "wechat-api/ent/usagedetail"
  30. "wechat-api/ent/usagetotal"
  31. "wechat-api/ent/workexperience"
  32. "wechat-api/ent/wx"
  33. "wechat-api/ent/wxcard"
  34. "wechat-api/ent/wxcarduser"
  35. "wechat-api/ent/wxcardvisit"
  36. "entgo.io/ent/dialect/sql"
  37. )
  38. // The Query interface represents an operation that queries a graph.
  39. // By using this interface, users can write generic code that manipulates
  40. // query builders of different types.
  41. type Query interface {
  42. // Type returns the string representation of the query type.
  43. Type() string
  44. // Limit the number of records to be returned by this query.
  45. Limit(int)
  46. // Offset to start from.
  47. Offset(int)
  48. // Unique configures the query builder to filter duplicate records.
  49. Unique(bool)
  50. // Order specifies how the records should be ordered.
  51. Order(...func(*sql.Selector))
  52. // WhereP appends storage-level predicates to the query builder. Using this method, users
  53. // can use type-assertion to append predicates that do not depend on any generated package.
  54. WhereP(...func(*sql.Selector))
  55. }
  56. // The Func type is an adapter that allows ordinary functions to be used as interceptors.
  57. // Unlike traversal functions, interceptors are skipped during graph traversals. Note that the
  58. // implementation of Func is different from the one defined in entgo.io/ent.InterceptFunc.
  59. type Func func(context.Context, Query) error
  60. // Intercept calls f(ctx, q) and then applied the next Querier.
  61. func (f Func) Intercept(next ent.Querier) ent.Querier {
  62. return ent.QuerierFunc(func(ctx context.Context, q ent.Query) (ent.Value, error) {
  63. query, err := NewQuery(q)
  64. if err != nil {
  65. return nil, err
  66. }
  67. if err := f(ctx, query); err != nil {
  68. return nil, err
  69. }
  70. return next.Query(ctx, q)
  71. })
  72. }
  73. // The TraverseFunc type is an adapter to allow the use of ordinary function as Traverser.
  74. // If f is a function with the appropriate signature, TraverseFunc(f) is a Traverser that calls f.
  75. type TraverseFunc func(context.Context, Query) error
  76. // Intercept is a dummy implementation of Intercept that returns the next Querier in the pipeline.
  77. func (f TraverseFunc) Intercept(next ent.Querier) ent.Querier {
  78. return next
  79. }
  80. // Traverse calls f(ctx, q).
  81. func (f TraverseFunc) Traverse(ctx context.Context, q ent.Query) error {
  82. query, err := NewQuery(q)
  83. if err != nil {
  84. return err
  85. }
  86. return f(ctx, query)
  87. }
  88. // The AgentFunc type is an adapter to allow the use of ordinary function as a Querier.
  89. type AgentFunc func(context.Context, *ent.AgentQuery) (ent.Value, error)
  90. // Query calls f(ctx, q).
  91. func (f AgentFunc) Query(ctx context.Context, q ent.Query) (ent.Value, error) {
  92. if q, ok := q.(*ent.AgentQuery); ok {
  93. return f(ctx, q)
  94. }
  95. return nil, fmt.Errorf("unexpected query type %T. expect *ent.AgentQuery", q)
  96. }
  97. // The TraverseAgent type is an adapter to allow the use of ordinary function as Traverser.
  98. type TraverseAgent func(context.Context, *ent.AgentQuery) error
  99. // Intercept is a dummy implementation of Intercept that returns the next Querier in the pipeline.
  100. func (f TraverseAgent) Intercept(next ent.Querier) ent.Querier {
  101. return next
  102. }
  103. // Traverse calls f(ctx, q).
  104. func (f TraverseAgent) Traverse(ctx context.Context, q ent.Query) error {
  105. if q, ok := q.(*ent.AgentQuery); ok {
  106. return f(ctx, q)
  107. }
  108. return fmt.Errorf("unexpected query type %T. expect *ent.AgentQuery", q)
  109. }
  110. // The AgentBaseFunc type is an adapter to allow the use of ordinary function as a Querier.
  111. type AgentBaseFunc func(context.Context, *ent.AgentBaseQuery) (ent.Value, error)
  112. // Query calls f(ctx, q).
  113. func (f AgentBaseFunc) Query(ctx context.Context, q ent.Query) (ent.Value, error) {
  114. if q, ok := q.(*ent.AgentBaseQuery); ok {
  115. return f(ctx, q)
  116. }
  117. return nil, fmt.Errorf("unexpected query type %T. expect *ent.AgentBaseQuery", q)
  118. }
  119. // The TraverseAgentBase type is an adapter to allow the use of ordinary function as Traverser.
  120. type TraverseAgentBase func(context.Context, *ent.AgentBaseQuery) error
  121. // Intercept is a dummy implementation of Intercept that returns the next Querier in the pipeline.
  122. func (f TraverseAgentBase) Intercept(next ent.Querier) ent.Querier {
  123. return next
  124. }
  125. // Traverse calls f(ctx, q).
  126. func (f TraverseAgentBase) Traverse(ctx context.Context, q ent.Query) error {
  127. if q, ok := q.(*ent.AgentBaseQuery); ok {
  128. return f(ctx, q)
  129. }
  130. return fmt.Errorf("unexpected query type %T. expect *ent.AgentBaseQuery", q)
  131. }
  132. // The AliyunAvatarFunc type is an adapter to allow the use of ordinary function as a Querier.
  133. type AliyunAvatarFunc func(context.Context, *ent.AliyunAvatarQuery) (ent.Value, error)
  134. // Query calls f(ctx, q).
  135. func (f AliyunAvatarFunc) Query(ctx context.Context, q ent.Query) (ent.Value, error) {
  136. if q, ok := q.(*ent.AliyunAvatarQuery); ok {
  137. return f(ctx, q)
  138. }
  139. return nil, fmt.Errorf("unexpected query type %T. expect *ent.AliyunAvatarQuery", q)
  140. }
  141. // The TraverseAliyunAvatar type is an adapter to allow the use of ordinary function as Traverser.
  142. type TraverseAliyunAvatar func(context.Context, *ent.AliyunAvatarQuery) error
  143. // Intercept is a dummy implementation of Intercept that returns the next Querier in the pipeline.
  144. func (f TraverseAliyunAvatar) Intercept(next ent.Querier) ent.Querier {
  145. return next
  146. }
  147. // Traverse calls f(ctx, q).
  148. func (f TraverseAliyunAvatar) Traverse(ctx context.Context, q ent.Query) error {
  149. if q, ok := q.(*ent.AliyunAvatarQuery); ok {
  150. return f(ctx, q)
  151. }
  152. return fmt.Errorf("unexpected query type %T. expect *ent.AliyunAvatarQuery", q)
  153. }
  154. // The BatchMsgFunc type is an adapter to allow the use of ordinary function as a Querier.
  155. type BatchMsgFunc func(context.Context, *ent.BatchMsgQuery) (ent.Value, error)
  156. // Query calls f(ctx, q).
  157. func (f BatchMsgFunc) Query(ctx context.Context, q ent.Query) (ent.Value, error) {
  158. if q, ok := q.(*ent.BatchMsgQuery); ok {
  159. return f(ctx, q)
  160. }
  161. return nil, fmt.Errorf("unexpected query type %T. expect *ent.BatchMsgQuery", q)
  162. }
  163. // The TraverseBatchMsg type is an adapter to allow the use of ordinary function as Traverser.
  164. type TraverseBatchMsg func(context.Context, *ent.BatchMsgQuery) error
  165. // Intercept is a dummy implementation of Intercept that returns the next Querier in the pipeline.
  166. func (f TraverseBatchMsg) Intercept(next ent.Querier) ent.Querier {
  167. return next
  168. }
  169. // Traverse calls f(ctx, q).
  170. func (f TraverseBatchMsg) Traverse(ctx context.Context, q ent.Query) error {
  171. if q, ok := q.(*ent.BatchMsgQuery); ok {
  172. return f(ctx, q)
  173. }
  174. return fmt.Errorf("unexpected query type %T. expect *ent.BatchMsgQuery", q)
  175. }
  176. // The CategoryFunc type is an adapter to allow the use of ordinary function as a Querier.
  177. type CategoryFunc func(context.Context, *ent.CategoryQuery) (ent.Value, error)
  178. // Query calls f(ctx, q).
  179. func (f CategoryFunc) Query(ctx context.Context, q ent.Query) (ent.Value, error) {
  180. if q, ok := q.(*ent.CategoryQuery); ok {
  181. return f(ctx, q)
  182. }
  183. return nil, fmt.Errorf("unexpected query type %T. expect *ent.CategoryQuery", q)
  184. }
  185. // The TraverseCategory type is an adapter to allow the use of ordinary function as Traverser.
  186. type TraverseCategory func(context.Context, *ent.CategoryQuery) error
  187. // Intercept is a dummy implementation of Intercept that returns the next Querier in the pipeline.
  188. func (f TraverseCategory) Intercept(next ent.Querier) ent.Querier {
  189. return next
  190. }
  191. // Traverse calls f(ctx, q).
  192. func (f TraverseCategory) Traverse(ctx context.Context, q ent.Query) error {
  193. if q, ok := q.(*ent.CategoryQuery); ok {
  194. return f(ctx, q)
  195. }
  196. return fmt.Errorf("unexpected query type %T. expect *ent.CategoryQuery", q)
  197. }
  198. // The ChatRecordsFunc type is an adapter to allow the use of ordinary function as a Querier.
  199. type ChatRecordsFunc func(context.Context, *ent.ChatRecordsQuery) (ent.Value, error)
  200. // Query calls f(ctx, q).
  201. func (f ChatRecordsFunc) Query(ctx context.Context, q ent.Query) (ent.Value, error) {
  202. if q, ok := q.(*ent.ChatRecordsQuery); ok {
  203. return f(ctx, q)
  204. }
  205. return nil, fmt.Errorf("unexpected query type %T. expect *ent.ChatRecordsQuery", q)
  206. }
  207. // The TraverseChatRecords type is an adapter to allow the use of ordinary function as Traverser.
  208. type TraverseChatRecords func(context.Context, *ent.ChatRecordsQuery) error
  209. // Intercept is a dummy implementation of Intercept that returns the next Querier in the pipeline.
  210. func (f TraverseChatRecords) Intercept(next ent.Querier) ent.Querier {
  211. return next
  212. }
  213. // Traverse calls f(ctx, q).
  214. func (f TraverseChatRecords) Traverse(ctx context.Context, q ent.Query) error {
  215. if q, ok := q.(*ent.ChatRecordsQuery); ok {
  216. return f(ctx, q)
  217. }
  218. return fmt.Errorf("unexpected query type %T. expect *ent.ChatRecordsQuery", q)
  219. }
  220. // The ChatSessionFunc type is an adapter to allow the use of ordinary function as a Querier.
  221. type ChatSessionFunc func(context.Context, *ent.ChatSessionQuery) (ent.Value, error)
  222. // Query calls f(ctx, q).
  223. func (f ChatSessionFunc) Query(ctx context.Context, q ent.Query) (ent.Value, error) {
  224. if q, ok := q.(*ent.ChatSessionQuery); ok {
  225. return f(ctx, q)
  226. }
  227. return nil, fmt.Errorf("unexpected query type %T. expect *ent.ChatSessionQuery", q)
  228. }
  229. // The TraverseChatSession type is an adapter to allow the use of ordinary function as Traverser.
  230. type TraverseChatSession func(context.Context, *ent.ChatSessionQuery) error
  231. // Intercept is a dummy implementation of Intercept that returns the next Querier in the pipeline.
  232. func (f TraverseChatSession) Intercept(next ent.Querier) ent.Querier {
  233. return next
  234. }
  235. // Traverse calls f(ctx, q).
  236. func (f TraverseChatSession) Traverse(ctx context.Context, q ent.Query) error {
  237. if q, ok := q.(*ent.ChatSessionQuery); ok {
  238. return f(ctx, q)
  239. }
  240. return fmt.Errorf("unexpected query type %T. expect *ent.ChatSessionQuery", q)
  241. }
  242. // The ContactFunc type is an adapter to allow the use of ordinary function as a Querier.
  243. type ContactFunc func(context.Context, *ent.ContactQuery) (ent.Value, error)
  244. // Query calls f(ctx, q).
  245. func (f ContactFunc) Query(ctx context.Context, q ent.Query) (ent.Value, error) {
  246. if q, ok := q.(*ent.ContactQuery); ok {
  247. return f(ctx, q)
  248. }
  249. return nil, fmt.Errorf("unexpected query type %T. expect *ent.ContactQuery", q)
  250. }
  251. // The TraverseContact type is an adapter to allow the use of ordinary function as Traverser.
  252. type TraverseContact func(context.Context, *ent.ContactQuery) error
  253. // Intercept is a dummy implementation of Intercept that returns the next Querier in the pipeline.
  254. func (f TraverseContact) Intercept(next ent.Querier) ent.Querier {
  255. return next
  256. }
  257. // Traverse calls f(ctx, q).
  258. func (f TraverseContact) Traverse(ctx context.Context, q ent.Query) error {
  259. if q, ok := q.(*ent.ContactQuery); ok {
  260. return f(ctx, q)
  261. }
  262. return fmt.Errorf("unexpected query type %T. expect *ent.ContactQuery", q)
  263. }
  264. // The EmployeeFunc type is an adapter to allow the use of ordinary function as a Querier.
  265. type EmployeeFunc func(context.Context, *ent.EmployeeQuery) (ent.Value, error)
  266. // Query calls f(ctx, q).
  267. func (f EmployeeFunc) Query(ctx context.Context, q ent.Query) (ent.Value, error) {
  268. if q, ok := q.(*ent.EmployeeQuery); ok {
  269. return f(ctx, q)
  270. }
  271. return nil, fmt.Errorf("unexpected query type %T. expect *ent.EmployeeQuery", q)
  272. }
  273. // The TraverseEmployee type is an adapter to allow the use of ordinary function as Traverser.
  274. type TraverseEmployee func(context.Context, *ent.EmployeeQuery) error
  275. // Intercept is a dummy implementation of Intercept that returns the next Querier in the pipeline.
  276. func (f TraverseEmployee) Intercept(next ent.Querier) ent.Querier {
  277. return next
  278. }
  279. // Traverse calls f(ctx, q).
  280. func (f TraverseEmployee) Traverse(ctx context.Context, q ent.Query) error {
  281. if q, ok := q.(*ent.EmployeeQuery); ok {
  282. return f(ctx, q)
  283. }
  284. return fmt.Errorf("unexpected query type %T. expect *ent.EmployeeQuery", q)
  285. }
  286. // The EmployeeConfigFunc type is an adapter to allow the use of ordinary function as a Querier.
  287. type EmployeeConfigFunc func(context.Context, *ent.EmployeeConfigQuery) (ent.Value, error)
  288. // Query calls f(ctx, q).
  289. func (f EmployeeConfigFunc) Query(ctx context.Context, q ent.Query) (ent.Value, error) {
  290. if q, ok := q.(*ent.EmployeeConfigQuery); ok {
  291. return f(ctx, q)
  292. }
  293. return nil, fmt.Errorf("unexpected query type %T. expect *ent.EmployeeConfigQuery", q)
  294. }
  295. // The TraverseEmployeeConfig type is an adapter to allow the use of ordinary function as Traverser.
  296. type TraverseEmployeeConfig func(context.Context, *ent.EmployeeConfigQuery) error
  297. // Intercept is a dummy implementation of Intercept that returns the next Querier in the pipeline.
  298. func (f TraverseEmployeeConfig) Intercept(next ent.Querier) ent.Querier {
  299. return next
  300. }
  301. // Traverse calls f(ctx, q).
  302. func (f TraverseEmployeeConfig) Traverse(ctx context.Context, q ent.Query) error {
  303. if q, ok := q.(*ent.EmployeeConfigQuery); ok {
  304. return f(ctx, q)
  305. }
  306. return fmt.Errorf("unexpected query type %T. expect *ent.EmployeeConfigQuery", q)
  307. }
  308. // The LabelFunc type is an adapter to allow the use of ordinary function as a Querier.
  309. type LabelFunc func(context.Context, *ent.LabelQuery) (ent.Value, error)
  310. // Query calls f(ctx, q).
  311. func (f LabelFunc) Query(ctx context.Context, q ent.Query) (ent.Value, error) {
  312. if q, ok := q.(*ent.LabelQuery); ok {
  313. return f(ctx, q)
  314. }
  315. return nil, fmt.Errorf("unexpected query type %T. expect *ent.LabelQuery", q)
  316. }
  317. // The TraverseLabel type is an adapter to allow the use of ordinary function as Traverser.
  318. type TraverseLabel func(context.Context, *ent.LabelQuery) error
  319. // Intercept is a dummy implementation of Intercept that returns the next Querier in the pipeline.
  320. func (f TraverseLabel) Intercept(next ent.Querier) ent.Querier {
  321. return next
  322. }
  323. // Traverse calls f(ctx, q).
  324. func (f TraverseLabel) Traverse(ctx context.Context, q ent.Query) error {
  325. if q, ok := q.(*ent.LabelQuery); ok {
  326. return f(ctx, q)
  327. }
  328. return fmt.Errorf("unexpected query type %T. expect *ent.LabelQuery", q)
  329. }
  330. // The LabelRelationshipFunc type is an adapter to allow the use of ordinary function as a Querier.
  331. type LabelRelationshipFunc func(context.Context, *ent.LabelRelationshipQuery) (ent.Value, error)
  332. // Query calls f(ctx, q).
  333. func (f LabelRelationshipFunc) Query(ctx context.Context, q ent.Query) (ent.Value, error) {
  334. if q, ok := q.(*ent.LabelRelationshipQuery); ok {
  335. return f(ctx, q)
  336. }
  337. return nil, fmt.Errorf("unexpected query type %T. expect *ent.LabelRelationshipQuery", q)
  338. }
  339. // The TraverseLabelRelationship type is an adapter to allow the use of ordinary function as Traverser.
  340. type TraverseLabelRelationship func(context.Context, *ent.LabelRelationshipQuery) error
  341. // Intercept is a dummy implementation of Intercept that returns the next Querier in the pipeline.
  342. func (f TraverseLabelRelationship) Intercept(next ent.Querier) ent.Querier {
  343. return next
  344. }
  345. // Traverse calls f(ctx, q).
  346. func (f TraverseLabelRelationship) Traverse(ctx context.Context, q ent.Query) error {
  347. if q, ok := q.(*ent.LabelRelationshipQuery); ok {
  348. return f(ctx, q)
  349. }
  350. return fmt.Errorf("unexpected query type %T. expect *ent.LabelRelationshipQuery", q)
  351. }
  352. // The MessageFunc type is an adapter to allow the use of ordinary function as a Querier.
  353. type MessageFunc func(context.Context, *ent.MessageQuery) (ent.Value, error)
  354. // Query calls f(ctx, q).
  355. func (f MessageFunc) Query(ctx context.Context, q ent.Query) (ent.Value, error) {
  356. if q, ok := q.(*ent.MessageQuery); ok {
  357. return f(ctx, q)
  358. }
  359. return nil, fmt.Errorf("unexpected query type %T. expect *ent.MessageQuery", q)
  360. }
  361. // The TraverseMessage type is an adapter to allow the use of ordinary function as Traverser.
  362. type TraverseMessage func(context.Context, *ent.MessageQuery) error
  363. // Intercept is a dummy implementation of Intercept that returns the next Querier in the pipeline.
  364. func (f TraverseMessage) Intercept(next ent.Querier) ent.Querier {
  365. return next
  366. }
  367. // Traverse calls f(ctx, q).
  368. func (f TraverseMessage) Traverse(ctx context.Context, q ent.Query) error {
  369. if q, ok := q.(*ent.MessageQuery); ok {
  370. return f(ctx, q)
  371. }
  372. return fmt.Errorf("unexpected query type %T. expect *ent.MessageQuery", q)
  373. }
  374. // The MessageRecordsFunc type is an adapter to allow the use of ordinary function as a Querier.
  375. type MessageRecordsFunc func(context.Context, *ent.MessageRecordsQuery) (ent.Value, error)
  376. // Query calls f(ctx, q).
  377. func (f MessageRecordsFunc) Query(ctx context.Context, q ent.Query) (ent.Value, error) {
  378. if q, ok := q.(*ent.MessageRecordsQuery); ok {
  379. return f(ctx, q)
  380. }
  381. return nil, fmt.Errorf("unexpected query type %T. expect *ent.MessageRecordsQuery", q)
  382. }
  383. // The TraverseMessageRecords type is an adapter to allow the use of ordinary function as Traverser.
  384. type TraverseMessageRecords func(context.Context, *ent.MessageRecordsQuery) error
  385. // Intercept is a dummy implementation of Intercept that returns the next Querier in the pipeline.
  386. func (f TraverseMessageRecords) Intercept(next ent.Querier) ent.Querier {
  387. return next
  388. }
  389. // Traverse calls f(ctx, q).
  390. func (f TraverseMessageRecords) Traverse(ctx context.Context, q ent.Query) error {
  391. if q, ok := q.(*ent.MessageRecordsQuery); ok {
  392. return f(ctx, q)
  393. }
  394. return fmt.Errorf("unexpected query type %T. expect *ent.MessageRecordsQuery", q)
  395. }
  396. // The MsgFunc type is an adapter to allow the use of ordinary function as a Querier.
  397. type MsgFunc func(context.Context, *ent.MsgQuery) (ent.Value, error)
  398. // Query calls f(ctx, q).
  399. func (f MsgFunc) Query(ctx context.Context, q ent.Query) (ent.Value, error) {
  400. if q, ok := q.(*ent.MsgQuery); ok {
  401. return f(ctx, q)
  402. }
  403. return nil, fmt.Errorf("unexpected query type %T. expect *ent.MsgQuery", q)
  404. }
  405. // The TraverseMsg type is an adapter to allow the use of ordinary function as Traverser.
  406. type TraverseMsg func(context.Context, *ent.MsgQuery) error
  407. // Intercept is a dummy implementation of Intercept that returns the next Querier in the pipeline.
  408. func (f TraverseMsg) Intercept(next ent.Querier) ent.Querier {
  409. return next
  410. }
  411. // Traverse calls f(ctx, q).
  412. func (f TraverseMsg) Traverse(ctx context.Context, q ent.Query) error {
  413. if q, ok := q.(*ent.MsgQuery); ok {
  414. return f(ctx, q)
  415. }
  416. return fmt.Errorf("unexpected query type %T. expect *ent.MsgQuery", q)
  417. }
  418. // The ServerFunc type is an adapter to allow the use of ordinary function as a Querier.
  419. type ServerFunc func(context.Context, *ent.ServerQuery) (ent.Value, error)
  420. // Query calls f(ctx, q).
  421. func (f ServerFunc) Query(ctx context.Context, q ent.Query) (ent.Value, error) {
  422. if q, ok := q.(*ent.ServerQuery); ok {
  423. return f(ctx, q)
  424. }
  425. return nil, fmt.Errorf("unexpected query type %T. expect *ent.ServerQuery", q)
  426. }
  427. // The TraverseServer type is an adapter to allow the use of ordinary function as Traverser.
  428. type TraverseServer func(context.Context, *ent.ServerQuery) error
  429. // Intercept is a dummy implementation of Intercept that returns the next Querier in the pipeline.
  430. func (f TraverseServer) Intercept(next ent.Querier) ent.Querier {
  431. return next
  432. }
  433. // Traverse calls f(ctx, q).
  434. func (f TraverseServer) Traverse(ctx context.Context, q ent.Query) error {
  435. if q, ok := q.(*ent.ServerQuery); ok {
  436. return f(ctx, q)
  437. }
  438. return fmt.Errorf("unexpected query type %T. expect *ent.ServerQuery", q)
  439. }
  440. // The SopNodeFunc type is an adapter to allow the use of ordinary function as a Querier.
  441. type SopNodeFunc func(context.Context, *ent.SopNodeQuery) (ent.Value, error)
  442. // Query calls f(ctx, q).
  443. func (f SopNodeFunc) Query(ctx context.Context, q ent.Query) (ent.Value, error) {
  444. if q, ok := q.(*ent.SopNodeQuery); ok {
  445. return f(ctx, q)
  446. }
  447. return nil, fmt.Errorf("unexpected query type %T. expect *ent.SopNodeQuery", q)
  448. }
  449. // The TraverseSopNode type is an adapter to allow the use of ordinary function as Traverser.
  450. type TraverseSopNode func(context.Context, *ent.SopNodeQuery) error
  451. // Intercept is a dummy implementation of Intercept that returns the next Querier in the pipeline.
  452. func (f TraverseSopNode) Intercept(next ent.Querier) ent.Querier {
  453. return next
  454. }
  455. // Traverse calls f(ctx, q).
  456. func (f TraverseSopNode) Traverse(ctx context.Context, q ent.Query) error {
  457. if q, ok := q.(*ent.SopNodeQuery); ok {
  458. return f(ctx, q)
  459. }
  460. return fmt.Errorf("unexpected query type %T. expect *ent.SopNodeQuery", q)
  461. }
  462. // The SopStageFunc type is an adapter to allow the use of ordinary function as a Querier.
  463. type SopStageFunc func(context.Context, *ent.SopStageQuery) (ent.Value, error)
  464. // Query calls f(ctx, q).
  465. func (f SopStageFunc) Query(ctx context.Context, q ent.Query) (ent.Value, error) {
  466. if q, ok := q.(*ent.SopStageQuery); ok {
  467. return f(ctx, q)
  468. }
  469. return nil, fmt.Errorf("unexpected query type %T. expect *ent.SopStageQuery", q)
  470. }
  471. // The TraverseSopStage type is an adapter to allow the use of ordinary function as Traverser.
  472. type TraverseSopStage func(context.Context, *ent.SopStageQuery) error
  473. // Intercept is a dummy implementation of Intercept that returns the next Querier in the pipeline.
  474. func (f TraverseSopStage) Intercept(next ent.Querier) ent.Querier {
  475. return next
  476. }
  477. // Traverse calls f(ctx, q).
  478. func (f TraverseSopStage) Traverse(ctx context.Context, q ent.Query) error {
  479. if q, ok := q.(*ent.SopStageQuery); ok {
  480. return f(ctx, q)
  481. }
  482. return fmt.Errorf("unexpected query type %T. expect *ent.SopStageQuery", q)
  483. }
  484. // The SopTaskFunc type is an adapter to allow the use of ordinary function as a Querier.
  485. type SopTaskFunc func(context.Context, *ent.SopTaskQuery) (ent.Value, error)
  486. // Query calls f(ctx, q).
  487. func (f SopTaskFunc) Query(ctx context.Context, q ent.Query) (ent.Value, error) {
  488. if q, ok := q.(*ent.SopTaskQuery); ok {
  489. return f(ctx, q)
  490. }
  491. return nil, fmt.Errorf("unexpected query type %T. expect *ent.SopTaskQuery", q)
  492. }
  493. // The TraverseSopTask type is an adapter to allow the use of ordinary function as Traverser.
  494. type TraverseSopTask func(context.Context, *ent.SopTaskQuery) error
  495. // Intercept is a dummy implementation of Intercept that returns the next Querier in the pipeline.
  496. func (f TraverseSopTask) Intercept(next ent.Querier) ent.Querier {
  497. return next
  498. }
  499. // Traverse calls f(ctx, q).
  500. func (f TraverseSopTask) Traverse(ctx context.Context, q ent.Query) error {
  501. if q, ok := q.(*ent.SopTaskQuery); ok {
  502. return f(ctx, q)
  503. }
  504. return fmt.Errorf("unexpected query type %T. expect *ent.SopTaskQuery", q)
  505. }
  506. // The TokenFunc type is an adapter to allow the use of ordinary function as a Querier.
  507. type TokenFunc func(context.Context, *ent.TokenQuery) (ent.Value, error)
  508. // Query calls f(ctx, q).
  509. func (f TokenFunc) Query(ctx context.Context, q ent.Query) (ent.Value, error) {
  510. if q, ok := q.(*ent.TokenQuery); ok {
  511. return f(ctx, q)
  512. }
  513. return nil, fmt.Errorf("unexpected query type %T. expect *ent.TokenQuery", q)
  514. }
  515. // The TraverseToken type is an adapter to allow the use of ordinary function as Traverser.
  516. type TraverseToken func(context.Context, *ent.TokenQuery) error
  517. // Intercept is a dummy implementation of Intercept that returns the next Querier in the pipeline.
  518. func (f TraverseToken) Intercept(next ent.Querier) ent.Querier {
  519. return next
  520. }
  521. // Traverse calls f(ctx, q).
  522. func (f TraverseToken) Traverse(ctx context.Context, q ent.Query) error {
  523. if q, ok := q.(*ent.TokenQuery); ok {
  524. return f(ctx, q)
  525. }
  526. return fmt.Errorf("unexpected query type %T. expect *ent.TokenQuery", q)
  527. }
  528. // The TutorialFunc type is an adapter to allow the use of ordinary function as a Querier.
  529. type TutorialFunc func(context.Context, *ent.TutorialQuery) (ent.Value, error)
  530. // Query calls f(ctx, q).
  531. func (f TutorialFunc) Query(ctx context.Context, q ent.Query) (ent.Value, error) {
  532. if q, ok := q.(*ent.TutorialQuery); ok {
  533. return f(ctx, q)
  534. }
  535. return nil, fmt.Errorf("unexpected query type %T. expect *ent.TutorialQuery", q)
  536. }
  537. // The TraverseTutorial type is an adapter to allow the use of ordinary function as Traverser.
  538. type TraverseTutorial func(context.Context, *ent.TutorialQuery) error
  539. // Intercept is a dummy implementation of Intercept that returns the next Querier in the pipeline.
  540. func (f TraverseTutorial) Intercept(next ent.Querier) ent.Querier {
  541. return next
  542. }
  543. // Traverse calls f(ctx, q).
  544. func (f TraverseTutorial) Traverse(ctx context.Context, q ent.Query) error {
  545. if q, ok := q.(*ent.TutorialQuery); ok {
  546. return f(ctx, q)
  547. }
  548. return fmt.Errorf("unexpected query type %T. expect *ent.TutorialQuery", q)
  549. }
  550. // The UsageDetailFunc type is an adapter to allow the use of ordinary function as a Querier.
  551. type UsageDetailFunc func(context.Context, *ent.UsageDetailQuery) (ent.Value, error)
  552. // Query calls f(ctx, q).
  553. func (f UsageDetailFunc) Query(ctx context.Context, q ent.Query) (ent.Value, error) {
  554. if q, ok := q.(*ent.UsageDetailQuery); ok {
  555. return f(ctx, q)
  556. }
  557. return nil, fmt.Errorf("unexpected query type %T. expect *ent.UsageDetailQuery", q)
  558. }
  559. // The TraverseUsageDetail type is an adapter to allow the use of ordinary function as Traverser.
  560. type TraverseUsageDetail func(context.Context, *ent.UsageDetailQuery) error
  561. // Intercept is a dummy implementation of Intercept that returns the next Querier in the pipeline.
  562. func (f TraverseUsageDetail) Intercept(next ent.Querier) ent.Querier {
  563. return next
  564. }
  565. // Traverse calls f(ctx, q).
  566. func (f TraverseUsageDetail) Traverse(ctx context.Context, q ent.Query) error {
  567. if q, ok := q.(*ent.UsageDetailQuery); ok {
  568. return f(ctx, q)
  569. }
  570. return fmt.Errorf("unexpected query type %T. expect *ent.UsageDetailQuery", q)
  571. }
  572. // The UsageTotalFunc type is an adapter to allow the use of ordinary function as a Querier.
  573. type UsageTotalFunc func(context.Context, *ent.UsageTotalQuery) (ent.Value, error)
  574. // Query calls f(ctx, q).
  575. func (f UsageTotalFunc) Query(ctx context.Context, q ent.Query) (ent.Value, error) {
  576. if q, ok := q.(*ent.UsageTotalQuery); ok {
  577. return f(ctx, q)
  578. }
  579. return nil, fmt.Errorf("unexpected query type %T. expect *ent.UsageTotalQuery", q)
  580. }
  581. // The TraverseUsageTotal type is an adapter to allow the use of ordinary function as Traverser.
  582. type TraverseUsageTotal func(context.Context, *ent.UsageTotalQuery) error
  583. // Intercept is a dummy implementation of Intercept that returns the next Querier in the pipeline.
  584. func (f TraverseUsageTotal) Intercept(next ent.Querier) ent.Querier {
  585. return next
  586. }
  587. // Traverse calls f(ctx, q).
  588. func (f TraverseUsageTotal) Traverse(ctx context.Context, q ent.Query) error {
  589. if q, ok := q.(*ent.UsageTotalQuery); ok {
  590. return f(ctx, q)
  591. }
  592. return fmt.Errorf("unexpected query type %T. expect *ent.UsageTotalQuery", q)
  593. }
  594. // The WorkExperienceFunc type is an adapter to allow the use of ordinary function as a Querier.
  595. type WorkExperienceFunc func(context.Context, *ent.WorkExperienceQuery) (ent.Value, error)
  596. // Query calls f(ctx, q).
  597. func (f WorkExperienceFunc) Query(ctx context.Context, q ent.Query) (ent.Value, error) {
  598. if q, ok := q.(*ent.WorkExperienceQuery); ok {
  599. return f(ctx, q)
  600. }
  601. return nil, fmt.Errorf("unexpected query type %T. expect *ent.WorkExperienceQuery", q)
  602. }
  603. // The TraverseWorkExperience type is an adapter to allow the use of ordinary function as Traverser.
  604. type TraverseWorkExperience func(context.Context, *ent.WorkExperienceQuery) error
  605. // Intercept is a dummy implementation of Intercept that returns the next Querier in the pipeline.
  606. func (f TraverseWorkExperience) Intercept(next ent.Querier) ent.Querier {
  607. return next
  608. }
  609. // Traverse calls f(ctx, q).
  610. func (f TraverseWorkExperience) Traverse(ctx context.Context, q ent.Query) error {
  611. if q, ok := q.(*ent.WorkExperienceQuery); ok {
  612. return f(ctx, q)
  613. }
  614. return fmt.Errorf("unexpected query type %T. expect *ent.WorkExperienceQuery", q)
  615. }
  616. // The WxFunc type is an adapter to allow the use of ordinary function as a Querier.
  617. type WxFunc func(context.Context, *ent.WxQuery) (ent.Value, error)
  618. // Query calls f(ctx, q).
  619. func (f WxFunc) Query(ctx context.Context, q ent.Query) (ent.Value, error) {
  620. if q, ok := q.(*ent.WxQuery); ok {
  621. return f(ctx, q)
  622. }
  623. return nil, fmt.Errorf("unexpected query type %T. expect *ent.WxQuery", q)
  624. }
  625. // The TraverseWx type is an adapter to allow the use of ordinary function as Traverser.
  626. type TraverseWx func(context.Context, *ent.WxQuery) error
  627. // Intercept is a dummy implementation of Intercept that returns the next Querier in the pipeline.
  628. func (f TraverseWx) Intercept(next ent.Querier) ent.Querier {
  629. return next
  630. }
  631. // Traverse calls f(ctx, q).
  632. func (f TraverseWx) Traverse(ctx context.Context, q ent.Query) error {
  633. if q, ok := q.(*ent.WxQuery); ok {
  634. return f(ctx, q)
  635. }
  636. return fmt.Errorf("unexpected query type %T. expect *ent.WxQuery", q)
  637. }
  638. // The WxCardFunc type is an adapter to allow the use of ordinary function as a Querier.
  639. type WxCardFunc func(context.Context, *ent.WxCardQuery) (ent.Value, error)
  640. // Query calls f(ctx, q).
  641. func (f WxCardFunc) Query(ctx context.Context, q ent.Query) (ent.Value, error) {
  642. if q, ok := q.(*ent.WxCardQuery); ok {
  643. return f(ctx, q)
  644. }
  645. return nil, fmt.Errorf("unexpected query type %T. expect *ent.WxCardQuery", q)
  646. }
  647. // The TraverseWxCard type is an adapter to allow the use of ordinary function as Traverser.
  648. type TraverseWxCard func(context.Context, *ent.WxCardQuery) error
  649. // Intercept is a dummy implementation of Intercept that returns the next Querier in the pipeline.
  650. func (f TraverseWxCard) Intercept(next ent.Querier) ent.Querier {
  651. return next
  652. }
  653. // Traverse calls f(ctx, q).
  654. func (f TraverseWxCard) Traverse(ctx context.Context, q ent.Query) error {
  655. if q, ok := q.(*ent.WxCardQuery); ok {
  656. return f(ctx, q)
  657. }
  658. return fmt.Errorf("unexpected query type %T. expect *ent.WxCardQuery", q)
  659. }
  660. // The WxCardUserFunc type is an adapter to allow the use of ordinary function as a Querier.
  661. type WxCardUserFunc func(context.Context, *ent.WxCardUserQuery) (ent.Value, error)
  662. // Query calls f(ctx, q).
  663. func (f WxCardUserFunc) Query(ctx context.Context, q ent.Query) (ent.Value, error) {
  664. if q, ok := q.(*ent.WxCardUserQuery); ok {
  665. return f(ctx, q)
  666. }
  667. return nil, fmt.Errorf("unexpected query type %T. expect *ent.WxCardUserQuery", q)
  668. }
  669. // The TraverseWxCardUser type is an adapter to allow the use of ordinary function as Traverser.
  670. type TraverseWxCardUser func(context.Context, *ent.WxCardUserQuery) error
  671. // Intercept is a dummy implementation of Intercept that returns the next Querier in the pipeline.
  672. func (f TraverseWxCardUser) Intercept(next ent.Querier) ent.Querier {
  673. return next
  674. }
  675. // Traverse calls f(ctx, q).
  676. func (f TraverseWxCardUser) Traverse(ctx context.Context, q ent.Query) error {
  677. if q, ok := q.(*ent.WxCardUserQuery); ok {
  678. return f(ctx, q)
  679. }
  680. return fmt.Errorf("unexpected query type %T. expect *ent.WxCardUserQuery", q)
  681. }
  682. // The WxCardVisitFunc type is an adapter to allow the use of ordinary function as a Querier.
  683. type WxCardVisitFunc func(context.Context, *ent.WxCardVisitQuery) (ent.Value, error)
  684. // Query calls f(ctx, q).
  685. func (f WxCardVisitFunc) Query(ctx context.Context, q ent.Query) (ent.Value, error) {
  686. if q, ok := q.(*ent.WxCardVisitQuery); ok {
  687. return f(ctx, q)
  688. }
  689. return nil, fmt.Errorf("unexpected query type %T. expect *ent.WxCardVisitQuery", q)
  690. }
  691. // The TraverseWxCardVisit type is an adapter to allow the use of ordinary function as Traverser.
  692. type TraverseWxCardVisit func(context.Context, *ent.WxCardVisitQuery) error
  693. // Intercept is a dummy implementation of Intercept that returns the next Querier in the pipeline.
  694. func (f TraverseWxCardVisit) Intercept(next ent.Querier) ent.Querier {
  695. return next
  696. }
  697. // Traverse calls f(ctx, q).
  698. func (f TraverseWxCardVisit) Traverse(ctx context.Context, q ent.Query) error {
  699. if q, ok := q.(*ent.WxCardVisitQuery); ok {
  700. return f(ctx, q)
  701. }
  702. return fmt.Errorf("unexpected query type %T. expect *ent.WxCardVisitQuery", q)
  703. }
  704. // NewQuery returns the generic Query interface for the given typed query.
  705. func NewQuery(q ent.Query) (Query, error) {
  706. switch q := q.(type) {
  707. case *ent.AgentQuery:
  708. return &query[*ent.AgentQuery, predicate.Agent, agent.OrderOption]{typ: ent.TypeAgent, tq: q}, nil
  709. case *ent.AgentBaseQuery:
  710. return &query[*ent.AgentBaseQuery, predicate.AgentBase, agentbase.OrderOption]{typ: ent.TypeAgentBase, tq: q}, nil
  711. case *ent.AliyunAvatarQuery:
  712. return &query[*ent.AliyunAvatarQuery, predicate.AliyunAvatar, aliyunavatar.OrderOption]{typ: ent.TypeAliyunAvatar, tq: q}, nil
  713. case *ent.BatchMsgQuery:
  714. return &query[*ent.BatchMsgQuery, predicate.BatchMsg, batchmsg.OrderOption]{typ: ent.TypeBatchMsg, tq: q}, nil
  715. case *ent.CategoryQuery:
  716. return &query[*ent.CategoryQuery, predicate.Category, category.OrderOption]{typ: ent.TypeCategory, tq: q}, nil
  717. case *ent.ChatRecordsQuery:
  718. return &query[*ent.ChatRecordsQuery, predicate.ChatRecords, chatrecords.OrderOption]{typ: ent.TypeChatRecords, tq: q}, nil
  719. case *ent.ChatSessionQuery:
  720. return &query[*ent.ChatSessionQuery, predicate.ChatSession, chatsession.OrderOption]{typ: ent.TypeChatSession, tq: q}, nil
  721. case *ent.ContactQuery:
  722. return &query[*ent.ContactQuery, predicate.Contact, contact.OrderOption]{typ: ent.TypeContact, tq: q}, nil
  723. case *ent.EmployeeQuery:
  724. return &query[*ent.EmployeeQuery, predicate.Employee, employee.OrderOption]{typ: ent.TypeEmployee, tq: q}, nil
  725. case *ent.EmployeeConfigQuery:
  726. return &query[*ent.EmployeeConfigQuery, predicate.EmployeeConfig, employeeconfig.OrderOption]{typ: ent.TypeEmployeeConfig, tq: q}, nil
  727. case *ent.LabelQuery:
  728. return &query[*ent.LabelQuery, predicate.Label, label.OrderOption]{typ: ent.TypeLabel, tq: q}, nil
  729. case *ent.LabelRelationshipQuery:
  730. return &query[*ent.LabelRelationshipQuery, predicate.LabelRelationship, labelrelationship.OrderOption]{typ: ent.TypeLabelRelationship, tq: q}, nil
  731. case *ent.MessageQuery:
  732. return &query[*ent.MessageQuery, predicate.Message, message.OrderOption]{typ: ent.TypeMessage, tq: q}, nil
  733. case *ent.MessageRecordsQuery:
  734. return &query[*ent.MessageRecordsQuery, predicate.MessageRecords, messagerecords.OrderOption]{typ: ent.TypeMessageRecords, tq: q}, nil
  735. case *ent.MsgQuery:
  736. return &query[*ent.MsgQuery, predicate.Msg, msg.OrderOption]{typ: ent.TypeMsg, tq: q}, nil
  737. case *ent.ServerQuery:
  738. return &query[*ent.ServerQuery, predicate.Server, server.OrderOption]{typ: ent.TypeServer, tq: q}, nil
  739. case *ent.SopNodeQuery:
  740. return &query[*ent.SopNodeQuery, predicate.SopNode, sopnode.OrderOption]{typ: ent.TypeSopNode, tq: q}, nil
  741. case *ent.SopStageQuery:
  742. return &query[*ent.SopStageQuery, predicate.SopStage, sopstage.OrderOption]{typ: ent.TypeSopStage, tq: q}, nil
  743. case *ent.SopTaskQuery:
  744. return &query[*ent.SopTaskQuery, predicate.SopTask, soptask.OrderOption]{typ: ent.TypeSopTask, tq: q}, nil
  745. case *ent.TokenQuery:
  746. return &query[*ent.TokenQuery, predicate.Token, token.OrderOption]{typ: ent.TypeToken, tq: q}, nil
  747. case *ent.TutorialQuery:
  748. return &query[*ent.TutorialQuery, predicate.Tutorial, tutorial.OrderOption]{typ: ent.TypeTutorial, tq: q}, nil
  749. case *ent.UsageDetailQuery:
  750. return &query[*ent.UsageDetailQuery, predicate.UsageDetail, usagedetail.OrderOption]{typ: ent.TypeUsageDetail, tq: q}, nil
  751. case *ent.UsageTotalQuery:
  752. return &query[*ent.UsageTotalQuery, predicate.UsageTotal, usagetotal.OrderOption]{typ: ent.TypeUsageTotal, tq: q}, nil
  753. case *ent.WorkExperienceQuery:
  754. return &query[*ent.WorkExperienceQuery, predicate.WorkExperience, workexperience.OrderOption]{typ: ent.TypeWorkExperience, tq: q}, nil
  755. case *ent.WxQuery:
  756. return &query[*ent.WxQuery, predicate.Wx, wx.OrderOption]{typ: ent.TypeWx, tq: q}, nil
  757. case *ent.WxCardQuery:
  758. return &query[*ent.WxCardQuery, predicate.WxCard, wxcard.OrderOption]{typ: ent.TypeWxCard, tq: q}, nil
  759. case *ent.WxCardUserQuery:
  760. return &query[*ent.WxCardUserQuery, predicate.WxCardUser, wxcarduser.OrderOption]{typ: ent.TypeWxCardUser, tq: q}, nil
  761. case *ent.WxCardVisitQuery:
  762. return &query[*ent.WxCardVisitQuery, predicate.WxCardVisit, wxcardvisit.OrderOption]{typ: ent.TypeWxCardVisit, tq: q}, nil
  763. default:
  764. return nil, fmt.Errorf("unknown query type %T", q)
  765. }
  766. }
  767. type query[T any, P ~func(*sql.Selector), R ~func(*sql.Selector)] struct {
  768. typ string
  769. tq interface {
  770. Limit(int) T
  771. Offset(int) T
  772. Unique(bool) T
  773. Order(...R) T
  774. Where(...P) T
  775. }
  776. }
  777. func (q query[T, P, R]) Type() string {
  778. return q.typ
  779. }
  780. func (q query[T, P, R]) Limit(limit int) {
  781. q.tq.Limit(limit)
  782. }
  783. func (q query[T, P, R]) Offset(offset int) {
  784. q.tq.Offset(offset)
  785. }
  786. func (q query[T, P, R]) Unique(unique bool) {
  787. q.tq.Unique(unique)
  788. }
  789. func (q query[T, P, R]) Order(orders ...func(*sql.Selector)) {
  790. rs := make([]R, len(orders))
  791. for i := range orders {
  792. rs[i] = orders[i]
  793. }
  794. q.tq.Order(rs...)
  795. }
  796. func (q query[T, P, R]) WhereP(ps ...func(*sql.Selector)) {
  797. p := make([]P, len(ps))
  798. for i := range ps {
  799. p[i] = ps[i]
  800. }
  801. q.tq.Where(p...)
  802. }