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

Method CallCost

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

Source from the content-addressed store, hash-verified

4357var timeToYearCost uint64 = 7
4358
4359func (e testRuntimeCostEstimator) CallCost(function, overloadID string, args []ref.Val, result ref.Val) *uint64 {
4360 argsSize := make([]uint64, len(args))
4361 for i, arg := range args {
4362 reflectV := reflect.ValueOf(arg.Value())
4363 switch reflectV.Kind() {
4364 // Note that the CEL bytes type is implemented with Go byte slices, therefore also supported by the following
4365 // code.
4366 case reflect.String, reflect.Array, reflect.Slice, reflect.Map:
4367 argsSize[i] = uint64(reflectV.Len())
4368 default:
4369 argsSize[i] = 1
4370 }
4371 }
4372 return nil
4373}
4374
4375func trackTimestampToYear(args []ref.Val, result ref.Val) *uint64 {
4376 return &timeToYearCost

Callers

nothing calls this directly

Calls 3

ValueMethod · 0.65
KindMethod · 0.65
LenMethod · 0.65

Tested by

no test coverage detected