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

Method ProgramOptions

ext/lists.go:391–418  ·  view source on GitHub ↗

ProgramOptions implements the Library interface method.

()

Source from the content-addressed store, hash-verified

389
390// ProgramOptions implements the Library interface method.
391func (lib *listsLib) ProgramOptions() []cel.ProgramOption {
392 var opts []cel.ProgramOption
393 if lib.version >= 3 {
394 // TODO: Add cost trackers for list operations
395 trackers := []interpreter.CostTrackerOption{
396 interpreter.OverloadCostTracker("list_slice", trackListOutputSize),
397 interpreter.OverloadCostTracker("list_flatten", trackListFlatten),
398 interpreter.OverloadCostTracker("list_flatten_int", trackListFlatten),
399 interpreter.OverloadCostTracker("lists_range", trackListOutputSize),
400 interpreter.OverloadCostTracker("list_reverse", trackListOutputSize),
401 interpreter.OverloadCostTracker("list_distinct", trackListDistinct),
402 }
403 for _, t := range comparableTypes {
404 trackers = append(trackers,
405 interpreter.OverloadCostTracker(
406 fmt.Sprintf("list_%s_sort", t.TypeName()),
407 trackListSort,
408 ),
409 interpreter.OverloadCostTracker(
410 fmt.Sprintf("list_%s_sortByAssociatedKeys", t.TypeName()),
411 trackListSortBy,
412 ),
413 )
414 }
415 opts = append(opts, cel.CostTrackerOptions(trackers...))
416 }
417 return opts
418}
419
420func genRange(n types.Int, maxSize int64) (ref.Val, error) {
421 if n < 0 {

Callers

nothing calls this directly

Calls 3

OverloadCostTrackerFunction · 0.92
CostTrackerOptionsFunction · 0.92
TypeNameMethod · 0.65

Tested by

no test coverage detected