MCPcopy Create free account
hub / github.com/chainloop-dev/chainloop / sqlScan

Method sqlScan

app/controlplane/pkg/data/ent/user_query.go:659–684  ·  view source on GitHub ↗
(ctx context.Context, root *UserQuery, v any)

Source from the content-addressed store, hash-verified

657}
658
659func (_g *UserGroupBy) sqlScan(ctx context.Context, root *UserQuery, v any) error {
660 selector := root.sqlQuery(ctx).Select()
661 aggregation := make([]string, 0, len(_g.fns))
662 for _, fn := range _g.fns {
663 aggregation = append(aggregation, fn(selector))
664 }
665 if len(selector.SelectedColumns()) == 0 {
666 columns := make([]string, 0, len(*_g.flds)+len(_g.fns))
667 for _, f := range *_g.flds {
668 columns = append(columns, selector.C(f))
669 }
670 columns = append(columns, aggregation...)
671 selector.Select(columns...)
672 }
673 selector.GroupBy(selector.Columns(*_g.flds...)...)
674 if err := selector.Err(); err != nil {
675 return err
676 }
677 rows := &sql.Rows{}
678 query, args := selector.Query()
679 if err := _g.build.driver.Query(ctx, query, args, rows); err != nil {
680 return err
681 }
682 defer rows.Close()
683 return sql.ScanSlice(rows, v)
684}
685
686// UserSelect is the builder for selecting fields of User entities.
687type UserSelect struct {

Callers

nothing calls this directly

Calls 5

SelectMethod · 0.45
sqlQueryMethod · 0.45
GroupByMethod · 0.45
QueryMethod · 0.45
CloseMethod · 0.45

Tested by

no test coverage detected