MCPcopy Create free account
hub / github.com/cel-expr/cel-go / CallCost

Method CallCost

cel/cel_test.go:3962–3976  ·  view source on GitHub ↗
(function, overloadID string, args []ref.Val, result ref.Val)

Source from the content-addressed store, hash-verified

3960var timeToYearCost uint64 = 7
3961
3962func (e testRuntimeCostEstimator) CallCost(function, overloadID string, args []ref.Val, result ref.Val) *uint64 {
3963 argsSize := make([]uint64, len(args))
3964 for i, arg := range args {
3965 reflectV := reflect.ValueOf(arg.Value())
3966 switch reflectV.Kind() {
3967 // Note that the CEL bytes type is implemented with Go byte slices, therefore also supported by the following
3968 // code.
3969 case reflect.String, reflect.Array, reflect.Slice, reflect.Map:
3970 argsSize[i] = uint64(reflectV.Len())
3971 default:
3972 argsSize[i] = 1
3973 }
3974 }
3975 return nil
3976}
3977
3978func trackTimestampToYear(args []ref.Val, result ref.Val) *uint64 {
3979 return &timeToYearCost

Callers

nothing calls this directly

Calls 3

ValueMethod · 0.65
KindMethod · 0.65
LenMethod · 0.65

Tested by

no test coverage detected