whatsapp_query.go 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605
  1. // Code generated by ent, DO NOT EDIT.
  2. package ent
  3. import (
  4. "context"
  5. "fmt"
  6. "math"
  7. "wechat-api/ent/agent"
  8. "wechat-api/ent/predicate"
  9. "wechat-api/ent/whatsapp"
  10. "entgo.io/ent/dialect/sql"
  11. "entgo.io/ent/dialect/sql/sqlgraph"
  12. "entgo.io/ent/schema/field"
  13. )
  14. // WhatsappQuery is the builder for querying Whatsapp entities.
  15. type WhatsappQuery struct {
  16. config
  17. ctx *QueryContext
  18. order []whatsapp.OrderOption
  19. inters []Interceptor
  20. predicates []predicate.Whatsapp
  21. withAgent *AgentQuery
  22. // intermediate query (i.e. traversal path).
  23. sql *sql.Selector
  24. path func(context.Context) (*sql.Selector, error)
  25. }
  26. // Where adds a new predicate for the WhatsappQuery builder.
  27. func (wq *WhatsappQuery) Where(ps ...predicate.Whatsapp) *WhatsappQuery {
  28. wq.predicates = append(wq.predicates, ps...)
  29. return wq
  30. }
  31. // Limit the number of records to be returned by this query.
  32. func (wq *WhatsappQuery) Limit(limit int) *WhatsappQuery {
  33. wq.ctx.Limit = &limit
  34. return wq
  35. }
  36. // Offset to start from.
  37. func (wq *WhatsappQuery) Offset(offset int) *WhatsappQuery {
  38. wq.ctx.Offset = &offset
  39. return wq
  40. }
  41. // Unique configures the query builder to filter duplicate records on query.
  42. // By default, unique is set to true, and can be disabled using this method.
  43. func (wq *WhatsappQuery) Unique(unique bool) *WhatsappQuery {
  44. wq.ctx.Unique = &unique
  45. return wq
  46. }
  47. // Order specifies how the records should be ordered.
  48. func (wq *WhatsappQuery) Order(o ...whatsapp.OrderOption) *WhatsappQuery {
  49. wq.order = append(wq.order, o...)
  50. return wq
  51. }
  52. // QueryAgent chains the current query on the "agent" edge.
  53. func (wq *WhatsappQuery) QueryAgent() *AgentQuery {
  54. query := (&AgentClient{config: wq.config}).Query()
  55. query.path = func(ctx context.Context) (fromU *sql.Selector, err error) {
  56. if err := wq.prepareQuery(ctx); err != nil {
  57. return nil, err
  58. }
  59. selector := wq.sqlQuery(ctx)
  60. if err := selector.Err(); err != nil {
  61. return nil, err
  62. }
  63. step := sqlgraph.NewStep(
  64. sqlgraph.From(whatsapp.Table, whatsapp.FieldID, selector),
  65. sqlgraph.To(agent.Table, agent.FieldID),
  66. sqlgraph.Edge(sqlgraph.M2O, true, whatsapp.AgentTable, whatsapp.AgentColumn),
  67. )
  68. fromU = sqlgraph.SetNeighbors(wq.driver.Dialect(), step)
  69. return fromU, nil
  70. }
  71. return query
  72. }
  73. // First returns the first Whatsapp entity from the query.
  74. // Returns a *NotFoundError when no Whatsapp was found.
  75. func (wq *WhatsappQuery) First(ctx context.Context) (*Whatsapp, error) {
  76. nodes, err := wq.Limit(1).All(setContextOp(ctx, wq.ctx, "First"))
  77. if err != nil {
  78. return nil, err
  79. }
  80. if len(nodes) == 0 {
  81. return nil, &NotFoundError{whatsapp.Label}
  82. }
  83. return nodes[0], nil
  84. }
  85. // FirstX is like First, but panics if an error occurs.
  86. func (wq *WhatsappQuery) FirstX(ctx context.Context) *Whatsapp {
  87. node, err := wq.First(ctx)
  88. if err != nil && !IsNotFound(err) {
  89. panic(err)
  90. }
  91. return node
  92. }
  93. // FirstID returns the first Whatsapp ID from the query.
  94. // Returns a *NotFoundError when no Whatsapp ID was found.
  95. func (wq *WhatsappQuery) FirstID(ctx context.Context) (id uint64, err error) {
  96. var ids []uint64
  97. if ids, err = wq.Limit(1).IDs(setContextOp(ctx, wq.ctx, "FirstID")); err != nil {
  98. return
  99. }
  100. if len(ids) == 0 {
  101. err = &NotFoundError{whatsapp.Label}
  102. return
  103. }
  104. return ids[0], nil
  105. }
  106. // FirstIDX is like FirstID, but panics if an error occurs.
  107. func (wq *WhatsappQuery) FirstIDX(ctx context.Context) uint64 {
  108. id, err := wq.FirstID(ctx)
  109. if err != nil && !IsNotFound(err) {
  110. panic(err)
  111. }
  112. return id
  113. }
  114. // Only returns a single Whatsapp entity found by the query, ensuring it only returns one.
  115. // Returns a *NotSingularError when more than one Whatsapp entity is found.
  116. // Returns a *NotFoundError when no Whatsapp entities are found.
  117. func (wq *WhatsappQuery) Only(ctx context.Context) (*Whatsapp, error) {
  118. nodes, err := wq.Limit(2).All(setContextOp(ctx, wq.ctx, "Only"))
  119. if err != nil {
  120. return nil, err
  121. }
  122. switch len(nodes) {
  123. case 1:
  124. return nodes[0], nil
  125. case 0:
  126. return nil, &NotFoundError{whatsapp.Label}
  127. default:
  128. return nil, &NotSingularError{whatsapp.Label}
  129. }
  130. }
  131. // OnlyX is like Only, but panics if an error occurs.
  132. func (wq *WhatsappQuery) OnlyX(ctx context.Context) *Whatsapp {
  133. node, err := wq.Only(ctx)
  134. if err != nil {
  135. panic(err)
  136. }
  137. return node
  138. }
  139. // OnlyID is like Only, but returns the only Whatsapp ID in the query.
  140. // Returns a *NotSingularError when more than one Whatsapp ID is found.
  141. // Returns a *NotFoundError when no entities are found.
  142. func (wq *WhatsappQuery) OnlyID(ctx context.Context) (id uint64, err error) {
  143. var ids []uint64
  144. if ids, err = wq.Limit(2).IDs(setContextOp(ctx, wq.ctx, "OnlyID")); err != nil {
  145. return
  146. }
  147. switch len(ids) {
  148. case 1:
  149. id = ids[0]
  150. case 0:
  151. err = &NotFoundError{whatsapp.Label}
  152. default:
  153. err = &NotSingularError{whatsapp.Label}
  154. }
  155. return
  156. }
  157. // OnlyIDX is like OnlyID, but panics if an error occurs.
  158. func (wq *WhatsappQuery) OnlyIDX(ctx context.Context) uint64 {
  159. id, err := wq.OnlyID(ctx)
  160. if err != nil {
  161. panic(err)
  162. }
  163. return id
  164. }
  165. // All executes the query and returns a list of Whatsapps.
  166. func (wq *WhatsappQuery) All(ctx context.Context) ([]*Whatsapp, error) {
  167. ctx = setContextOp(ctx, wq.ctx, "All")
  168. if err := wq.prepareQuery(ctx); err != nil {
  169. return nil, err
  170. }
  171. qr := querierAll[[]*Whatsapp, *WhatsappQuery]()
  172. return withInterceptors[[]*Whatsapp](ctx, wq, qr, wq.inters)
  173. }
  174. // AllX is like All, but panics if an error occurs.
  175. func (wq *WhatsappQuery) AllX(ctx context.Context) []*Whatsapp {
  176. nodes, err := wq.All(ctx)
  177. if err != nil {
  178. panic(err)
  179. }
  180. return nodes
  181. }
  182. // IDs executes the query and returns a list of Whatsapp IDs.
  183. func (wq *WhatsappQuery) IDs(ctx context.Context) (ids []uint64, err error) {
  184. if wq.ctx.Unique == nil && wq.path != nil {
  185. wq.Unique(true)
  186. }
  187. ctx = setContextOp(ctx, wq.ctx, "IDs")
  188. if err = wq.Select(whatsapp.FieldID).Scan(ctx, &ids); err != nil {
  189. return nil, err
  190. }
  191. return ids, nil
  192. }
  193. // IDsX is like IDs, but panics if an error occurs.
  194. func (wq *WhatsappQuery) IDsX(ctx context.Context) []uint64 {
  195. ids, err := wq.IDs(ctx)
  196. if err != nil {
  197. panic(err)
  198. }
  199. return ids
  200. }
  201. // Count returns the count of the given query.
  202. func (wq *WhatsappQuery) Count(ctx context.Context) (int, error) {
  203. ctx = setContextOp(ctx, wq.ctx, "Count")
  204. if err := wq.prepareQuery(ctx); err != nil {
  205. return 0, err
  206. }
  207. return withInterceptors[int](ctx, wq, querierCount[*WhatsappQuery](), wq.inters)
  208. }
  209. // CountX is like Count, but panics if an error occurs.
  210. func (wq *WhatsappQuery) CountX(ctx context.Context) int {
  211. count, err := wq.Count(ctx)
  212. if err != nil {
  213. panic(err)
  214. }
  215. return count
  216. }
  217. // Exist returns true if the query has elements in the graph.
  218. func (wq *WhatsappQuery) Exist(ctx context.Context) (bool, error) {
  219. ctx = setContextOp(ctx, wq.ctx, "Exist")
  220. switch _, err := wq.FirstID(ctx); {
  221. case IsNotFound(err):
  222. return false, nil
  223. case err != nil:
  224. return false, fmt.Errorf("ent: check existence: %w", err)
  225. default:
  226. return true, nil
  227. }
  228. }
  229. // ExistX is like Exist, but panics if an error occurs.
  230. func (wq *WhatsappQuery) ExistX(ctx context.Context) bool {
  231. exist, err := wq.Exist(ctx)
  232. if err != nil {
  233. panic(err)
  234. }
  235. return exist
  236. }
  237. // Clone returns a duplicate of the WhatsappQuery builder, including all associated steps. It can be
  238. // used to prepare common query builders and use them differently after the clone is made.
  239. func (wq *WhatsappQuery) Clone() *WhatsappQuery {
  240. if wq == nil {
  241. return nil
  242. }
  243. return &WhatsappQuery{
  244. config: wq.config,
  245. ctx: wq.ctx.Clone(),
  246. order: append([]whatsapp.OrderOption{}, wq.order...),
  247. inters: append([]Interceptor{}, wq.inters...),
  248. predicates: append([]predicate.Whatsapp{}, wq.predicates...),
  249. withAgent: wq.withAgent.Clone(),
  250. // clone intermediate query.
  251. sql: wq.sql.Clone(),
  252. path: wq.path,
  253. }
  254. }
  255. // WithAgent tells the query-builder to eager-load the nodes that are connected to
  256. // the "agent" edge. The optional arguments are used to configure the query builder of the edge.
  257. func (wq *WhatsappQuery) WithAgent(opts ...func(*AgentQuery)) *WhatsappQuery {
  258. query := (&AgentClient{config: wq.config}).Query()
  259. for _, opt := range opts {
  260. opt(query)
  261. }
  262. wq.withAgent = query
  263. return wq
  264. }
  265. // GroupBy is used to group vertices by one or more fields/columns.
  266. // It is often used with aggregate functions, like: count, max, mean, min, sum.
  267. //
  268. // Example:
  269. //
  270. // var v []struct {
  271. // CreatedAt time.Time `json:"created_at,omitempty"`
  272. // Count int `json:"count,omitempty"`
  273. // }
  274. //
  275. // client.Whatsapp.Query().
  276. // GroupBy(whatsapp.FieldCreatedAt).
  277. // Aggregate(ent.Count()).
  278. // Scan(ctx, &v)
  279. func (wq *WhatsappQuery) GroupBy(field string, fields ...string) *WhatsappGroupBy {
  280. wq.ctx.Fields = append([]string{field}, fields...)
  281. grbuild := &WhatsappGroupBy{build: wq}
  282. grbuild.flds = &wq.ctx.Fields
  283. grbuild.label = whatsapp.Label
  284. grbuild.scan = grbuild.Scan
  285. return grbuild
  286. }
  287. // Select allows the selection one or more fields/columns for the given query,
  288. // instead of selecting all fields in the entity.
  289. //
  290. // Example:
  291. //
  292. // var v []struct {
  293. // CreatedAt time.Time `json:"created_at,omitempty"`
  294. // }
  295. //
  296. // client.Whatsapp.Query().
  297. // Select(whatsapp.FieldCreatedAt).
  298. // Scan(ctx, &v)
  299. func (wq *WhatsappQuery) Select(fields ...string) *WhatsappSelect {
  300. wq.ctx.Fields = append(wq.ctx.Fields, fields...)
  301. sbuild := &WhatsappSelect{WhatsappQuery: wq}
  302. sbuild.label = whatsapp.Label
  303. sbuild.flds, sbuild.scan = &wq.ctx.Fields, sbuild.Scan
  304. return sbuild
  305. }
  306. // Aggregate returns a WhatsappSelect configured with the given aggregations.
  307. func (wq *WhatsappQuery) Aggregate(fns ...AggregateFunc) *WhatsappSelect {
  308. return wq.Select().Aggregate(fns...)
  309. }
  310. func (wq *WhatsappQuery) prepareQuery(ctx context.Context) error {
  311. for _, inter := range wq.inters {
  312. if inter == nil {
  313. return fmt.Errorf("ent: uninitialized interceptor (forgotten import ent/runtime?)")
  314. }
  315. if trv, ok := inter.(Traverser); ok {
  316. if err := trv.Traverse(ctx, wq); err != nil {
  317. return err
  318. }
  319. }
  320. }
  321. for _, f := range wq.ctx.Fields {
  322. if !whatsapp.ValidColumn(f) {
  323. return &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)}
  324. }
  325. }
  326. if wq.path != nil {
  327. prev, err := wq.path(ctx)
  328. if err != nil {
  329. return err
  330. }
  331. wq.sql = prev
  332. }
  333. return nil
  334. }
  335. func (wq *WhatsappQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*Whatsapp, error) {
  336. var (
  337. nodes = []*Whatsapp{}
  338. _spec = wq.querySpec()
  339. loadedTypes = [1]bool{
  340. wq.withAgent != nil,
  341. }
  342. )
  343. _spec.ScanValues = func(columns []string) ([]any, error) {
  344. return (*Whatsapp).scanValues(nil, columns)
  345. }
  346. _spec.Assign = func(columns []string, values []any) error {
  347. node := &Whatsapp{config: wq.config}
  348. nodes = append(nodes, node)
  349. node.Edges.loadedTypes = loadedTypes
  350. return node.assignValues(columns, values)
  351. }
  352. for i := range hooks {
  353. hooks[i](ctx, _spec)
  354. }
  355. if err := sqlgraph.QueryNodes(ctx, wq.driver, _spec); err != nil {
  356. return nil, err
  357. }
  358. if len(nodes) == 0 {
  359. return nodes, nil
  360. }
  361. if query := wq.withAgent; query != nil {
  362. if err := wq.loadAgent(ctx, query, nodes, nil,
  363. func(n *Whatsapp, e *Agent) { n.Edges.Agent = e }); err != nil {
  364. return nil, err
  365. }
  366. }
  367. return nodes, nil
  368. }
  369. func (wq *WhatsappQuery) loadAgent(ctx context.Context, query *AgentQuery, nodes []*Whatsapp, init func(*Whatsapp), assign func(*Whatsapp, *Agent)) error {
  370. ids := make([]uint64, 0, len(nodes))
  371. nodeids := make(map[uint64][]*Whatsapp)
  372. for i := range nodes {
  373. fk := nodes[i].AgentID
  374. if _, ok := nodeids[fk]; !ok {
  375. ids = append(ids, fk)
  376. }
  377. nodeids[fk] = append(nodeids[fk], nodes[i])
  378. }
  379. if len(ids) == 0 {
  380. return nil
  381. }
  382. query.Where(agent.IDIn(ids...))
  383. neighbors, err := query.All(ctx)
  384. if err != nil {
  385. return err
  386. }
  387. for _, n := range neighbors {
  388. nodes, ok := nodeids[n.ID]
  389. if !ok {
  390. return fmt.Errorf(`unexpected foreign-key "agent_id" returned %v`, n.ID)
  391. }
  392. for i := range nodes {
  393. assign(nodes[i], n)
  394. }
  395. }
  396. return nil
  397. }
  398. func (wq *WhatsappQuery) sqlCount(ctx context.Context) (int, error) {
  399. _spec := wq.querySpec()
  400. _spec.Node.Columns = wq.ctx.Fields
  401. if len(wq.ctx.Fields) > 0 {
  402. _spec.Unique = wq.ctx.Unique != nil && *wq.ctx.Unique
  403. }
  404. return sqlgraph.CountNodes(ctx, wq.driver, _spec)
  405. }
  406. func (wq *WhatsappQuery) querySpec() *sqlgraph.QuerySpec {
  407. _spec := sqlgraph.NewQuerySpec(whatsapp.Table, whatsapp.Columns, sqlgraph.NewFieldSpec(whatsapp.FieldID, field.TypeUint64))
  408. _spec.From = wq.sql
  409. if unique := wq.ctx.Unique; unique != nil {
  410. _spec.Unique = *unique
  411. } else if wq.path != nil {
  412. _spec.Unique = true
  413. }
  414. if fields := wq.ctx.Fields; len(fields) > 0 {
  415. _spec.Node.Columns = make([]string, 0, len(fields))
  416. _spec.Node.Columns = append(_spec.Node.Columns, whatsapp.FieldID)
  417. for i := range fields {
  418. if fields[i] != whatsapp.FieldID {
  419. _spec.Node.Columns = append(_spec.Node.Columns, fields[i])
  420. }
  421. }
  422. if wq.withAgent != nil {
  423. _spec.Node.AddColumnOnce(whatsapp.FieldAgentID)
  424. }
  425. }
  426. if ps := wq.predicates; len(ps) > 0 {
  427. _spec.Predicate = func(selector *sql.Selector) {
  428. for i := range ps {
  429. ps[i](selector)
  430. }
  431. }
  432. }
  433. if limit := wq.ctx.Limit; limit != nil {
  434. _spec.Limit = *limit
  435. }
  436. if offset := wq.ctx.Offset; offset != nil {
  437. _spec.Offset = *offset
  438. }
  439. if ps := wq.order; len(ps) > 0 {
  440. _spec.Order = func(selector *sql.Selector) {
  441. for i := range ps {
  442. ps[i](selector)
  443. }
  444. }
  445. }
  446. return _spec
  447. }
  448. func (wq *WhatsappQuery) sqlQuery(ctx context.Context) *sql.Selector {
  449. builder := sql.Dialect(wq.driver.Dialect())
  450. t1 := builder.Table(whatsapp.Table)
  451. columns := wq.ctx.Fields
  452. if len(columns) == 0 {
  453. columns = whatsapp.Columns
  454. }
  455. selector := builder.Select(t1.Columns(columns...)...).From(t1)
  456. if wq.sql != nil {
  457. selector = wq.sql
  458. selector.Select(selector.Columns(columns...)...)
  459. }
  460. if wq.ctx.Unique != nil && *wq.ctx.Unique {
  461. selector.Distinct()
  462. }
  463. for _, p := range wq.predicates {
  464. p(selector)
  465. }
  466. for _, p := range wq.order {
  467. p(selector)
  468. }
  469. if offset := wq.ctx.Offset; offset != nil {
  470. // limit is mandatory for offset clause. We start
  471. // with default value, and override it below if needed.
  472. selector.Offset(*offset).Limit(math.MaxInt32)
  473. }
  474. if limit := wq.ctx.Limit; limit != nil {
  475. selector.Limit(*limit)
  476. }
  477. return selector
  478. }
  479. // WhatsappGroupBy is the group-by builder for Whatsapp entities.
  480. type WhatsappGroupBy struct {
  481. selector
  482. build *WhatsappQuery
  483. }
  484. // Aggregate adds the given aggregation functions to the group-by query.
  485. func (wgb *WhatsappGroupBy) Aggregate(fns ...AggregateFunc) *WhatsappGroupBy {
  486. wgb.fns = append(wgb.fns, fns...)
  487. return wgb
  488. }
  489. // Scan applies the selector query and scans the result into the given value.
  490. func (wgb *WhatsappGroupBy) Scan(ctx context.Context, v any) error {
  491. ctx = setContextOp(ctx, wgb.build.ctx, "GroupBy")
  492. if err := wgb.build.prepareQuery(ctx); err != nil {
  493. return err
  494. }
  495. return scanWithInterceptors[*WhatsappQuery, *WhatsappGroupBy](ctx, wgb.build, wgb, wgb.build.inters, v)
  496. }
  497. func (wgb *WhatsappGroupBy) sqlScan(ctx context.Context, root *WhatsappQuery, v any) error {
  498. selector := root.sqlQuery(ctx).Select()
  499. aggregation := make([]string, 0, len(wgb.fns))
  500. for _, fn := range wgb.fns {
  501. aggregation = append(aggregation, fn(selector))
  502. }
  503. if len(selector.SelectedColumns()) == 0 {
  504. columns := make([]string, 0, len(*wgb.flds)+len(wgb.fns))
  505. for _, f := range *wgb.flds {
  506. columns = append(columns, selector.C(f))
  507. }
  508. columns = append(columns, aggregation...)
  509. selector.Select(columns...)
  510. }
  511. selector.GroupBy(selector.Columns(*wgb.flds...)...)
  512. if err := selector.Err(); err != nil {
  513. return err
  514. }
  515. rows := &sql.Rows{}
  516. query, args := selector.Query()
  517. if err := wgb.build.driver.Query(ctx, query, args, rows); err != nil {
  518. return err
  519. }
  520. defer rows.Close()
  521. return sql.ScanSlice(rows, v)
  522. }
  523. // WhatsappSelect is the builder for selecting fields of Whatsapp entities.
  524. type WhatsappSelect struct {
  525. *WhatsappQuery
  526. selector
  527. }
  528. // Aggregate adds the given aggregation functions to the selector query.
  529. func (ws *WhatsappSelect) Aggregate(fns ...AggregateFunc) *WhatsappSelect {
  530. ws.fns = append(ws.fns, fns...)
  531. return ws
  532. }
  533. // Scan applies the selector query and scans the result into the given value.
  534. func (ws *WhatsappSelect) Scan(ctx context.Context, v any) error {
  535. ctx = setContextOp(ctx, ws.ctx, "Select")
  536. if err := ws.prepareQuery(ctx); err != nil {
  537. return err
  538. }
  539. return scanWithInterceptors[*WhatsappQuery, *WhatsappSelect](ctx, ws.WhatsappQuery, ws, ws.inters, v)
  540. }
  541. func (ws *WhatsappSelect) sqlScan(ctx context.Context, root *WhatsappQuery, v any) error {
  542. selector := root.sqlQuery(ctx)
  543. aggregation := make([]string, 0, len(ws.fns))
  544. for _, fn := range ws.fns {
  545. aggregation = append(aggregation, fn(selector))
  546. }
  547. switch n := len(*ws.selector.flds); {
  548. case n == 0 && len(aggregation) > 0:
  549. selector.Select(aggregation...)
  550. case n != 0 && len(aggregation) > 0:
  551. selector.AppendSelect(aggregation...)
  552. }
  553. rows := &sql.Rows{}
  554. query, args := selector.Query()
  555. if err := ws.driver.Query(ctx, query, args, rows); err != nil {
  556. return err
  557. }
  558. defer rows.Close()
  559. return sql.ScanSlice(rows, v)
  560. }