MCPcopy Index your code
hub / github.com/cloudreve/cloudreve / sqlScan

Method sqlScan

ent/davaccount_query.go:586–605  ·  view source on GitHub ↗
(ctx context.Context, root *DavAccountQuery, v any)

Source from the content-addressed store, hash-verified

584}
585
586func (das *DavAccountSelect) sqlScan(ctx context.Context, root *DavAccountQuery, v any) error {
587 selector := root.sqlQuery(ctx)
588 aggregation := make([]string, 0, len(das.fns))
589 for _, fn := range das.fns {
590 aggregation = append(aggregation, fn(selector))
591 }
592 switch n := len(*das.selector.flds); {
593 case n == 0 && len(aggregation) > 0:
594 selector.Select(aggregation...)
595 case n != 0 && len(aggregation) > 0:
596 selector.AppendSelect(aggregation...)
597 }
598 rows := &sql.Rows{}
599 query, args := selector.Query()
600 if err := das.driver.Query(ctx, query, args, rows); err != nil {
601 return err
602 }
603 defer rows.Close()
604 return sql.ScanSlice(rows, v)
605}

Callers

nothing calls this directly

Calls 4

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

Tested by

no test coverage detected