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

Function Mean

app/controlplane/pkg/data/ent/ent.go:177–185  ·  view source on GitHub ↗

Mean applies the "mean" aggregation function on the given field of each group.

(field string)

Source from the content-addressed store, hash-verified

175
176// Mean applies the "mean" aggregation function on the given field of each group.
177func Mean(field string) AggregateFunc {
178 return func(s *sql.Selector) string {
179 if err := checkColumn(s.TableName(), field); err != nil {
180 s.AddError(&ValidationError{Name: field, err: fmt.Errorf("ent: %w", err)})
181 return ""
182 }
183 return sql.Avg(s.C(field))
184 }
185}
186
187// Min applies the "min" aggregation function on the given field of each group.
188func Min(field string) AggregateFunc {

Callers

nothing calls this directly

Calls 2

checkColumnFunction · 0.85
AddErrorMethod · 0.80

Tested by

no test coverage detected