ent.go 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666
  1. // Code generated by ent, DO NOT EDIT.
  2. package ent
  3. import (
  4. "context"
  5. "errors"
  6. "fmt"
  7. "reflect"
  8. "sync"
  9. "wechat-api/ent/agent"
  10. "wechat-api/ent/agentbase"
  11. "wechat-api/ent/aliyunavatar"
  12. "wechat-api/ent/batchmsg"
  13. "wechat-api/ent/category"
  14. "wechat-api/ent/chatrecords"
  15. "wechat-api/ent/chatsession"
  16. "wechat-api/ent/contact"
  17. "wechat-api/ent/employee"
  18. "wechat-api/ent/employeeconfig"
  19. "wechat-api/ent/label"
  20. "wechat-api/ent/labelrelationship"
  21. "wechat-api/ent/message"
  22. "wechat-api/ent/messagerecords"
  23. "wechat-api/ent/msg"
  24. "wechat-api/ent/server"
  25. "wechat-api/ent/sopnode"
  26. "wechat-api/ent/sopstage"
  27. "wechat-api/ent/soptask"
  28. "wechat-api/ent/token"
  29. "wechat-api/ent/tutorial"
  30. "wechat-api/ent/usagedetail"
  31. "wechat-api/ent/usagetotal"
  32. "wechat-api/ent/workexperience"
  33. "wechat-api/ent/wpchatroom"
  34. "wechat-api/ent/wpchatroommember"
  35. "wechat-api/ent/wx"
  36. "wechat-api/ent/wxcard"
  37. "wechat-api/ent/wxcarduser"
  38. "wechat-api/ent/wxcardvisit"
  39. "entgo.io/ent"
  40. "entgo.io/ent/dialect/sql"
  41. "entgo.io/ent/dialect/sql/sqlgraph"
  42. )
  43. // ent aliases to avoid import conflicts in user's code.
  44. type (
  45. Op = ent.Op
  46. Hook = ent.Hook
  47. Value = ent.Value
  48. Query = ent.Query
  49. QueryContext = ent.QueryContext
  50. Querier = ent.Querier
  51. QuerierFunc = ent.QuerierFunc
  52. Interceptor = ent.Interceptor
  53. InterceptFunc = ent.InterceptFunc
  54. Traverser = ent.Traverser
  55. TraverseFunc = ent.TraverseFunc
  56. Policy = ent.Policy
  57. Mutator = ent.Mutator
  58. Mutation = ent.Mutation
  59. MutateFunc = ent.MutateFunc
  60. )
  61. type clientCtxKey struct{}
  62. // FromContext returns a Client stored inside a context, or nil if there isn't one.
  63. func FromContext(ctx context.Context) *Client {
  64. c, _ := ctx.Value(clientCtxKey{}).(*Client)
  65. return c
  66. }
  67. // NewContext returns a new context with the given Client attached.
  68. func NewContext(parent context.Context, c *Client) context.Context {
  69. return context.WithValue(parent, clientCtxKey{}, c)
  70. }
  71. type txCtxKey struct{}
  72. // TxFromContext returns a Tx stored inside a context, or nil if there isn't one.
  73. func TxFromContext(ctx context.Context) *Tx {
  74. tx, _ := ctx.Value(txCtxKey{}).(*Tx)
  75. return tx
  76. }
  77. // NewTxContext returns a new context with the given Tx attached.
  78. func NewTxContext(parent context.Context, tx *Tx) context.Context {
  79. return context.WithValue(parent, txCtxKey{}, tx)
  80. }
  81. // OrderFunc applies an ordering on the sql selector.
  82. // Deprecated: Use Asc/Desc functions or the package builders instead.
  83. type OrderFunc func(*sql.Selector)
  84. var (
  85. initCheck sync.Once
  86. columnCheck sql.ColumnCheck
  87. )
  88. // columnChecker checks if the column exists in the given table.
  89. func checkColumn(table, column string) error {
  90. initCheck.Do(func() {
  91. columnCheck = sql.NewColumnCheck(map[string]func(string) bool{
  92. agent.Table: agent.ValidColumn,
  93. agentbase.Table: agentbase.ValidColumn,
  94. aliyunavatar.Table: aliyunavatar.ValidColumn,
  95. batchmsg.Table: batchmsg.ValidColumn,
  96. category.Table: category.ValidColumn,
  97. chatrecords.Table: chatrecords.ValidColumn,
  98. chatsession.Table: chatsession.ValidColumn,
  99. contact.Table: contact.ValidColumn,
  100. employee.Table: employee.ValidColumn,
  101. employeeconfig.Table: employeeconfig.ValidColumn,
  102. label.Table: label.ValidColumn,
  103. labelrelationship.Table: labelrelationship.ValidColumn,
  104. message.Table: message.ValidColumn,
  105. messagerecords.Table: messagerecords.ValidColumn,
  106. msg.Table: msg.ValidColumn,
  107. server.Table: server.ValidColumn,
  108. sopnode.Table: sopnode.ValidColumn,
  109. sopstage.Table: sopstage.ValidColumn,
  110. soptask.Table: soptask.ValidColumn,
  111. token.Table: token.ValidColumn,
  112. tutorial.Table: tutorial.ValidColumn,
  113. usagedetail.Table: usagedetail.ValidColumn,
  114. usagetotal.Table: usagetotal.ValidColumn,
  115. workexperience.Table: workexperience.ValidColumn,
  116. wpchatroom.Table: wpchatroom.ValidColumn,
  117. wpchatroommember.Table: wpchatroommember.ValidColumn,
  118. wx.Table: wx.ValidColumn,
  119. wxcard.Table: wxcard.ValidColumn,
  120. wxcarduser.Table: wxcarduser.ValidColumn,
  121. wxcardvisit.Table: wxcardvisit.ValidColumn,
  122. })
  123. })
  124. return columnCheck(table, column)
  125. }
  126. // Asc applies the given fields in ASC order.
  127. func Asc(fields ...string) func(*sql.Selector) {
  128. return func(s *sql.Selector) {
  129. for _, f := range fields {
  130. if err := checkColumn(s.TableName(), f); err != nil {
  131. s.AddError(&ValidationError{Name: f, err: fmt.Errorf("ent: %w", err)})
  132. }
  133. s.OrderBy(sql.Asc(s.C(f)))
  134. }
  135. }
  136. }
  137. // Desc applies the given fields in DESC order.
  138. func Desc(fields ...string) func(*sql.Selector) {
  139. return func(s *sql.Selector) {
  140. for _, f := range fields {
  141. if err := checkColumn(s.TableName(), f); err != nil {
  142. s.AddError(&ValidationError{Name: f, err: fmt.Errorf("ent: %w", err)})
  143. }
  144. s.OrderBy(sql.Desc(s.C(f)))
  145. }
  146. }
  147. }
  148. // AggregateFunc applies an aggregation step on the group-by traversal/selector.
  149. type AggregateFunc func(*sql.Selector) string
  150. // As is a pseudo aggregation function for renaming another other functions with custom names. For example:
  151. //
  152. // GroupBy(field1, field2).
  153. // Aggregate(ent.As(ent.Sum(field1), "sum_field1"), (ent.As(ent.Sum(field2), "sum_field2")).
  154. // Scan(ctx, &v)
  155. func As(fn AggregateFunc, end string) AggregateFunc {
  156. return func(s *sql.Selector) string {
  157. return sql.As(fn(s), end)
  158. }
  159. }
  160. // Count applies the "count" aggregation function on each group.
  161. func Count() AggregateFunc {
  162. return func(s *sql.Selector) string {
  163. return sql.Count("*")
  164. }
  165. }
  166. // Max applies the "max" aggregation function on the given field of each group.
  167. func Max(field string) AggregateFunc {
  168. return func(s *sql.Selector) string {
  169. if err := checkColumn(s.TableName(), field); err != nil {
  170. s.AddError(&ValidationError{Name: field, err: fmt.Errorf("ent: %w", err)})
  171. return ""
  172. }
  173. return sql.Max(s.C(field))
  174. }
  175. }
  176. // Mean applies the "mean" aggregation function on the given field of each group.
  177. func Mean(field string) AggregateFunc {
  178. return func(s *sql.Selector) string {
  179. if err := checkColumn(s.TableName(), field); err != nil {
  180. s.AddError(&ValidationError{Name: field, err: fmt.Errorf("ent: %w", err)})
  181. return ""
  182. }
  183. return sql.Avg(s.C(field))
  184. }
  185. }
  186. // Min applies the "min" aggregation function on the given field of each group.
  187. func Min(field string) AggregateFunc {
  188. return func(s *sql.Selector) string {
  189. if err := checkColumn(s.TableName(), field); err != nil {
  190. s.AddError(&ValidationError{Name: field, err: fmt.Errorf("ent: %w", err)})
  191. return ""
  192. }
  193. return sql.Min(s.C(field))
  194. }
  195. }
  196. // Sum applies the "sum" aggregation function on the given field of each group.
  197. func Sum(field string) AggregateFunc {
  198. return func(s *sql.Selector) string {
  199. if err := checkColumn(s.TableName(), field); err != nil {
  200. s.AddError(&ValidationError{Name: field, err: fmt.Errorf("ent: %w", err)})
  201. return ""
  202. }
  203. return sql.Sum(s.C(field))
  204. }
  205. }
  206. // ValidationError returns when validating a field or edge fails.
  207. type ValidationError struct {
  208. Name string // Field or edge name.
  209. err error
  210. }
  211. // Error implements the error interface.
  212. func (e *ValidationError) Error() string {
  213. return e.err.Error()
  214. }
  215. // Unwrap implements the errors.Wrapper interface.
  216. func (e *ValidationError) Unwrap() error {
  217. return e.err
  218. }
  219. // IsValidationError returns a boolean indicating whether the error is a validation error.
  220. func IsValidationError(err error) bool {
  221. if err == nil {
  222. return false
  223. }
  224. var e *ValidationError
  225. return errors.As(err, &e)
  226. }
  227. // NotFoundError returns when trying to fetch a specific entity and it was not found in the database.
  228. type NotFoundError struct {
  229. label string
  230. }
  231. // Error implements the error interface.
  232. func (e *NotFoundError) Error() string {
  233. return "ent: " + e.label + " not found"
  234. }
  235. // IsNotFound returns a boolean indicating whether the error is a not found error.
  236. func IsNotFound(err error) bool {
  237. if err == nil {
  238. return false
  239. }
  240. var e *NotFoundError
  241. return errors.As(err, &e)
  242. }
  243. // MaskNotFound masks not found error.
  244. func MaskNotFound(err error) error {
  245. if IsNotFound(err) {
  246. return nil
  247. }
  248. return err
  249. }
  250. // NotSingularError returns when trying to fetch a singular entity and more then one was found in the database.
  251. type NotSingularError struct {
  252. label string
  253. }
  254. // Error implements the error interface.
  255. func (e *NotSingularError) Error() string {
  256. return "ent: " + e.label + " not singular"
  257. }
  258. // IsNotSingular returns a boolean indicating whether the error is a not singular error.
  259. func IsNotSingular(err error) bool {
  260. if err == nil {
  261. return false
  262. }
  263. var e *NotSingularError
  264. return errors.As(err, &e)
  265. }
  266. // NotLoadedError returns when trying to get a node that was not loaded by the query.
  267. type NotLoadedError struct {
  268. edge string
  269. }
  270. // Error implements the error interface.
  271. func (e *NotLoadedError) Error() string {
  272. return "ent: " + e.edge + " edge was not loaded"
  273. }
  274. // IsNotLoaded returns a boolean indicating whether the error is a not loaded error.
  275. func IsNotLoaded(err error) bool {
  276. if err == nil {
  277. return false
  278. }
  279. var e *NotLoadedError
  280. return errors.As(err, &e)
  281. }
  282. // ConstraintError returns when trying to create/update one or more entities and
  283. // one or more of their constraints failed. For example, violation of edge or
  284. // field uniqueness.
  285. type ConstraintError struct {
  286. msg string
  287. wrap error
  288. }
  289. // Error implements the error interface.
  290. func (e ConstraintError) Error() string {
  291. return "ent: constraint failed: " + e.msg
  292. }
  293. // Unwrap implements the errors.Wrapper interface.
  294. func (e *ConstraintError) Unwrap() error {
  295. return e.wrap
  296. }
  297. // IsConstraintError returns a boolean indicating whether the error is a constraint failure.
  298. func IsConstraintError(err error) bool {
  299. if err == nil {
  300. return false
  301. }
  302. var e *ConstraintError
  303. return errors.As(err, &e)
  304. }
  305. // selector embedded by the different Select/GroupBy builders.
  306. type selector struct {
  307. label string
  308. flds *[]string
  309. fns []AggregateFunc
  310. scan func(context.Context, any) error
  311. }
  312. // ScanX is like Scan, but panics if an error occurs.
  313. func (s *selector) ScanX(ctx context.Context, v any) {
  314. if err := s.scan(ctx, v); err != nil {
  315. panic(err)
  316. }
  317. }
  318. // Strings returns list of strings from a selector. It is only allowed when selecting one field.
  319. func (s *selector) Strings(ctx context.Context) ([]string, error) {
  320. if len(*s.flds) > 1 {
  321. return nil, errors.New("ent: Strings is not achievable when selecting more than 1 field")
  322. }
  323. var v []string
  324. if err := s.scan(ctx, &v); err != nil {
  325. return nil, err
  326. }
  327. return v, nil
  328. }
  329. // StringsX is like Strings, but panics if an error occurs.
  330. func (s *selector) StringsX(ctx context.Context) []string {
  331. v, err := s.Strings(ctx)
  332. if err != nil {
  333. panic(err)
  334. }
  335. return v
  336. }
  337. // String returns a single string from a selector. It is only allowed when selecting one field.
  338. func (s *selector) String(ctx context.Context) (_ string, err error) {
  339. var v []string
  340. if v, err = s.Strings(ctx); err != nil {
  341. return
  342. }
  343. switch len(v) {
  344. case 1:
  345. return v[0], nil
  346. case 0:
  347. err = &NotFoundError{s.label}
  348. default:
  349. err = fmt.Errorf("ent: Strings returned %d results when one was expected", len(v))
  350. }
  351. return
  352. }
  353. // StringX is like String, but panics if an error occurs.
  354. func (s *selector) StringX(ctx context.Context) string {
  355. v, err := s.String(ctx)
  356. if err != nil {
  357. panic(err)
  358. }
  359. return v
  360. }
  361. // Ints returns list of ints from a selector. It is only allowed when selecting one field.
  362. func (s *selector) Ints(ctx context.Context) ([]int, error) {
  363. if len(*s.flds) > 1 {
  364. return nil, errors.New("ent: Ints is not achievable when selecting more than 1 field")
  365. }
  366. var v []int
  367. if err := s.scan(ctx, &v); err != nil {
  368. return nil, err
  369. }
  370. return v, nil
  371. }
  372. // IntsX is like Ints, but panics if an error occurs.
  373. func (s *selector) IntsX(ctx context.Context) []int {
  374. v, err := s.Ints(ctx)
  375. if err != nil {
  376. panic(err)
  377. }
  378. return v
  379. }
  380. // Int returns a single int from a selector. It is only allowed when selecting one field.
  381. func (s *selector) Int(ctx context.Context) (_ int, err error) {
  382. var v []int
  383. if v, err = s.Ints(ctx); err != nil {
  384. return
  385. }
  386. switch len(v) {
  387. case 1:
  388. return v[0], nil
  389. case 0:
  390. err = &NotFoundError{s.label}
  391. default:
  392. err = fmt.Errorf("ent: Ints returned %d results when one was expected", len(v))
  393. }
  394. return
  395. }
  396. // IntX is like Int, but panics if an error occurs.
  397. func (s *selector) IntX(ctx context.Context) int {
  398. v, err := s.Int(ctx)
  399. if err != nil {
  400. panic(err)
  401. }
  402. return v
  403. }
  404. // Float64s returns list of float64s from a selector. It is only allowed when selecting one field.
  405. func (s *selector) Float64s(ctx context.Context) ([]float64, error) {
  406. if len(*s.flds) > 1 {
  407. return nil, errors.New("ent: Float64s is not achievable when selecting more than 1 field")
  408. }
  409. var v []float64
  410. if err := s.scan(ctx, &v); err != nil {
  411. return nil, err
  412. }
  413. return v, nil
  414. }
  415. // Float64sX is like Float64s, but panics if an error occurs.
  416. func (s *selector) Float64sX(ctx context.Context) []float64 {
  417. v, err := s.Float64s(ctx)
  418. if err != nil {
  419. panic(err)
  420. }
  421. return v
  422. }
  423. // Float64 returns a single float64 from a selector. It is only allowed when selecting one field.
  424. func (s *selector) Float64(ctx context.Context) (_ float64, err error) {
  425. var v []float64
  426. if v, err = s.Float64s(ctx); err != nil {
  427. return
  428. }
  429. switch len(v) {
  430. case 1:
  431. return v[0], nil
  432. case 0:
  433. err = &NotFoundError{s.label}
  434. default:
  435. err = fmt.Errorf("ent: Float64s returned %d results when one was expected", len(v))
  436. }
  437. return
  438. }
  439. // Float64X is like Float64, but panics if an error occurs.
  440. func (s *selector) Float64X(ctx context.Context) float64 {
  441. v, err := s.Float64(ctx)
  442. if err != nil {
  443. panic(err)
  444. }
  445. return v
  446. }
  447. // Bools returns list of bools from a selector. It is only allowed when selecting one field.
  448. func (s *selector) Bools(ctx context.Context) ([]bool, error) {
  449. if len(*s.flds) > 1 {
  450. return nil, errors.New("ent: Bools is not achievable when selecting more than 1 field")
  451. }
  452. var v []bool
  453. if err := s.scan(ctx, &v); err != nil {
  454. return nil, err
  455. }
  456. return v, nil
  457. }
  458. // BoolsX is like Bools, but panics if an error occurs.
  459. func (s *selector) BoolsX(ctx context.Context) []bool {
  460. v, err := s.Bools(ctx)
  461. if err != nil {
  462. panic(err)
  463. }
  464. return v
  465. }
  466. // Bool returns a single bool from a selector. It is only allowed when selecting one field.
  467. func (s *selector) Bool(ctx context.Context) (_ bool, err error) {
  468. var v []bool
  469. if v, err = s.Bools(ctx); err != nil {
  470. return
  471. }
  472. switch len(v) {
  473. case 1:
  474. return v[0], nil
  475. case 0:
  476. err = &NotFoundError{s.label}
  477. default:
  478. err = fmt.Errorf("ent: Bools returned %d results when one was expected", len(v))
  479. }
  480. return
  481. }
  482. // BoolX is like Bool, but panics if an error occurs.
  483. func (s *selector) BoolX(ctx context.Context) bool {
  484. v, err := s.Bool(ctx)
  485. if err != nil {
  486. panic(err)
  487. }
  488. return v
  489. }
  490. // withHooks invokes the builder operation with the given hooks, if any.
  491. func withHooks[V Value, M any, PM interface {
  492. *M
  493. Mutation
  494. }](ctx context.Context, exec func(context.Context) (V, error), mutation PM, hooks []Hook) (value V, err error) {
  495. if len(hooks) == 0 {
  496. return exec(ctx)
  497. }
  498. var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {
  499. mutationT, ok := any(m).(PM)
  500. if !ok {
  501. return nil, fmt.Errorf("unexpected mutation type %T", m)
  502. }
  503. // Set the mutation to the builder.
  504. *mutation = *mutationT
  505. return exec(ctx)
  506. })
  507. for i := len(hooks) - 1; i >= 0; i-- {
  508. if hooks[i] == nil {
  509. return value, fmt.Errorf("ent: uninitialized hook (forgotten import ent/runtime?)")
  510. }
  511. mut = hooks[i](mut)
  512. }
  513. v, err := mut.Mutate(ctx, mutation)
  514. if err != nil {
  515. return value, err
  516. }
  517. nv, ok := v.(V)
  518. if !ok {
  519. return value, fmt.Errorf("unexpected node type %T returned from %T", v, mutation)
  520. }
  521. return nv, nil
  522. }
  523. // setContextOp returns a new context with the given QueryContext attached (including its op) in case it does not exist.
  524. func setContextOp(ctx context.Context, qc *QueryContext, op string) context.Context {
  525. if ent.QueryFromContext(ctx) == nil {
  526. qc.Op = op
  527. ctx = ent.NewQueryContext(ctx, qc)
  528. }
  529. return ctx
  530. }
  531. func querierAll[V Value, Q interface {
  532. sqlAll(context.Context, ...queryHook) (V, error)
  533. }]() Querier {
  534. return QuerierFunc(func(ctx context.Context, q Query) (Value, error) {
  535. query, ok := q.(Q)
  536. if !ok {
  537. return nil, fmt.Errorf("unexpected query type %T", q)
  538. }
  539. return query.sqlAll(ctx)
  540. })
  541. }
  542. func querierCount[Q interface {
  543. sqlCount(context.Context) (int, error)
  544. }]() Querier {
  545. return QuerierFunc(func(ctx context.Context, q Query) (Value, error) {
  546. query, ok := q.(Q)
  547. if !ok {
  548. return nil, fmt.Errorf("unexpected query type %T", q)
  549. }
  550. return query.sqlCount(ctx)
  551. })
  552. }
  553. func withInterceptors[V Value](ctx context.Context, q Query, qr Querier, inters []Interceptor) (v V, err error) {
  554. for i := len(inters) - 1; i >= 0; i-- {
  555. qr = inters[i].Intercept(qr)
  556. }
  557. rv, err := qr.Query(ctx, q)
  558. if err != nil {
  559. return v, err
  560. }
  561. vt, ok := rv.(V)
  562. if !ok {
  563. return v, fmt.Errorf("unexpected type %T returned from %T. expected type: %T", vt, q, v)
  564. }
  565. return vt, nil
  566. }
  567. func scanWithInterceptors[Q1 ent.Query, Q2 interface {
  568. sqlScan(context.Context, Q1, any) error
  569. }](ctx context.Context, rootQuery Q1, selectOrGroup Q2, inters []Interceptor, v any) error {
  570. rv := reflect.ValueOf(v)
  571. var qr Querier = QuerierFunc(func(ctx context.Context, q Query) (Value, error) {
  572. query, ok := q.(Q1)
  573. if !ok {
  574. return nil, fmt.Errorf("unexpected query type %T", q)
  575. }
  576. if err := selectOrGroup.sqlScan(ctx, query, v); err != nil {
  577. return nil, err
  578. }
  579. if k := rv.Kind(); k == reflect.Pointer && rv.Elem().CanInterface() {
  580. return rv.Elem().Interface(), nil
  581. }
  582. return v, nil
  583. })
  584. for i := len(inters) - 1; i >= 0; i-- {
  585. qr = inters[i].Intercept(qr)
  586. }
  587. vv, err := qr.Query(ctx, rootQuery)
  588. if err != nil {
  589. return err
  590. }
  591. switch rv2 := reflect.ValueOf(vv); {
  592. case rv.IsNil(), rv2.IsNil(), rv.Kind() != reflect.Pointer:
  593. case rv.Type() == rv2.Type():
  594. rv.Elem().Set(rv2.Elem())
  595. case rv.Elem().Type() == rv2.Type():
  596. rv.Elem().Set(rv2)
  597. }
  598. return nil
  599. }
  600. // queryHook describes an internal hook for the different sqlAll methods.
  601. type queryHook func(context.Context, *sqlgraph.QuerySpec)