| 631 | } |
| 632 | |
| 633 | func (gcs *GitCommitSelect) sqlScan(ctx context.Context, root *GitCommitQuery, v any) error { |
| 634 | selector := root.sqlQuery(ctx) |
| 635 | aggregation := make([]string, 0, len(gcs.fns)) |
| 636 | for _, fn := range gcs.fns { |
| 637 | aggregation = append(aggregation, fn(selector)) |
| 638 | } |
| 639 | switch n := len(*gcs.selector.flds); { |
| 640 | case n == 0 && len(aggregation) > 0: |
| 641 | selector.Select(aggregation...) |
| 642 | case n != 0 && len(aggregation) > 0: |
| 643 | selector.AppendSelect(aggregation...) |
| 644 | } |
| 645 | rows := &sql.Rows{} |
| 646 | query, args := selector.Query() |
| 647 | if err := gcs.driver.Query(ctx, query, args, rows); err != nil { |
| 648 | return err |
| 649 | } |
| 650 | defer rows.Close() |
| 651 | return sql.ScanSlice(rows, v) |
| 652 | } |
| 653 | |
| 654 | // Modify adds a query modifier for attaching custom logic to queries. |
| 655 | func (gcs *GitCommitSelect) Modify(modifiers ...func(s *sql.Selector)) *GitCommitSelect { |