MCPcopy
hub / github.com/expr-lang/expr / validateRoundFunc

Function validateRoundFunc

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

Source from the content-addressed store, hash-verified

26}
27
28func validateRoundFunc(name string, args []reflect.Type) (reflect.Type, error) {
29 if len(args) != 1 {
30 return anyType, fmt.Errorf("invalid number of arguments (expected 1, got %d)", len(args))
31 }
32 switch kind(args[0]) {
33 case reflect.Float32, reflect.Float64, reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64, reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Interface:
34 return floatType, nil
35 default:
36 return anyType, fmt.Errorf("invalid argument for %s (type %s)", name, args[0])
37 }
38}

Callers 1

builtin.goFile · 0.85

Calls 2

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…