ent.go 18 KB

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