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

Function Sum

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

Sum applies the "sum" aggregation function on the given field of each group.

(field string)

Source from the content-addressed store, hash-verified

197
198// Sum applies the "sum" aggregation function on the given field of each group.
199func Sum(field string) AggregateFunc {
200 return func(s *sql.Selector) string {
201 if err := checkColumn(s.TableName(), field); err != nil {
202 s.AddError(&ValidationError{Name: field, err: fmt.Errorf("ent: %w", err)})
203 return ""
204 }
205 return sql.Sum(s.C(field))
206 }
207}
208
209// ValidationError returns when validating a field or edge fails.
210type ValidationError struct {

Callers

nothing calls this directly

Calls 2

checkColumnFunction · 0.85
AddErrorMethod · 0.80

Tested by

no test coverage detected