MCPcopy Create free account
hub / github.com/an0nfunc/ALHP / sqlScan

Method sqlScan

ent/dbpackage_query.go:477–502  ·  view source on GitHub ↗
(ctx context.Context, root *DBPackageQuery, v any)

Source from the content-addressed store, hash-verified

475}
476
477func (_g *DBPackageGroupBy) sqlScan(ctx context.Context, root *DBPackageQuery, v any) error {
478 selector := root.sqlQuery(ctx).Select()
479 aggregation := make([]string, 0, len(_g.fns))
480 for _, fn := range _g.fns {
481 aggregation = append(aggregation, fn(selector))
482 }
483 if len(selector.SelectedColumns()) == 0 {
484 columns := make([]string, 0, len(*_g.flds)+len(_g.fns))
485 for _, f := range *_g.flds {
486 columns = append(columns, selector.C(f))
487 }
488 columns = append(columns, aggregation...)
489 selector.Select(columns...)
490 }
491 selector.GroupBy(selector.Columns(*_g.flds...)...)
492 if err := selector.Err(); err != nil {
493 return err
494 }
495 rows := &sql.Rows{}
496 query, args := selector.Query()
497 if err := _g.build.driver.Query(ctx, query, args, rows); err != nil {
498 return err
499 }
500 defer rows.Close()
501 return sql.ScanSlice(rows, v)
502}
503
504// DBPackageSelect is the builder for selecting fields of DBPackage entities.
505type DBPackageSelect struct {

Callers

nothing calls this directly

Calls 5

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

Tested by

no test coverage detected