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

Method sqlScan

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

Source from the content-addressed store, hash-verified

705}
706
707func (_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.
729func (_s *UserSelect) Modify(modifiers ...func(s *sql.Selector)) *UserSelect {

Callers 1

scanWithInterceptorsFunction · 0.45

Calls 4

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

Tested by

no test coverage detected