(ctx context.Context, root *UserQuery, v any)
| 705 | } |
| 706 | |
| 707 | func (_s *UserSelect) sqlScan(ctx context.Context, root *UserQuery, v any) error { |
| 708 | selector := root.sqlQuery(ctx) |
| 709 | aggregation := make([]string, 0, len(_s.fns)) |
| 710 | for _, fn := range _s.fns { |
| 711 | aggregation = append(aggregation, fn(selector)) |
| 712 | } |
| 713 | switch n := len(*_s.selector.flds); { |
| 714 | case n == 0 && len(aggregation) > 0: |
| 715 | selector.Select(aggregation...) |
| 716 | case n != 0 && len(aggregation) > 0: |
| 717 | selector.AppendSelect(aggregation...) |
| 718 | } |
| 719 | rows := &sql.Rows{} |
| 720 | query, args := selector.Query() |
| 721 | if err := _s.driver.Query(ctx, query, args, rows); err != nil { |
| 722 | return err |
| 723 | } |
| 724 | defer rows.Close() |
| 725 | return sql.ScanSlice(rows, v) |
| 726 | } |
| 727 | |
| 728 | // Modify adds a query modifier for attaching custom logic to queries. |
| 729 | func (_s *UserSelect) Modify(modifiers ...func(s *sql.Selector)) *UserSelect { |
no test coverage detected