MCPcopy Index your code
hub / github.com/expr-lang/expr / validateAggregateFunc

Function validateAggregateFunc

builtin/validation.go:10–26  ·  view source on GitHub ↗
(name string, args []reflect.Type)

Source from the content-addressed store, hash-verified

8)
9
10func validateAggregateFunc(name string, args []reflect.Type) (reflect.Type, error) {
11 switch len(args) {
12 case 0:
13 return anyType, fmt.Errorf("not enough arguments to call %s", name)
14 default:
15 for _, arg := range args {
16 switch kind(deref.Type(arg)) {
17 case reflect.Interface, reflect.Array, reflect.Slice:
18 return anyType, nil
19 case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64, reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Float32, reflect.Float64:
20 default:
21 return anyType, fmt.Errorf("invalid argument for %s (type %s)", name, arg)
22 }
23 }
24 return args[0], nil
25 }
26}
27
28func validateRoundFunc(name string, args []reflect.Type) (reflect.Type, error) {
29 if len(args) != 1 {

Callers 1

builtin.goFile · 0.85

Calls 3

TypeFunction · 0.92
kindFunction · 0.70
ErrorfMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…