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

Method ProgramOptions

ext/lists.go:414–449  ·  view source on GitHub ↗

ProgramOptions implements the Library interface method.

()

Source from the content-addressed store, hash-verified

412
413// ProgramOptions implements the Library interface method.
414func (lib *listsLib) ProgramOptions() []cel.ProgramOption {
415 var opts []cel.ProgramOption
416 if lib.version >= 3 {
417 trackers := []interpreter.CostTrackerOption{
418 interpreter.OverloadCostTracker("list_slice", trackListOutputSize),
419 interpreter.OverloadCostTracker("lists_range", trackListOutputSize),
420 interpreter.OverloadCostTracker("list_reverse", trackListOutputSize),
421 interpreter.OverloadCostTracker("list_distinct", trackListDistinct),
422 }
423 if lib.version == 3 {
424 trackers = append(trackers,
425 interpreter.OverloadCostTracker("list_flatten", trackListFlattenLegacy),
426 interpreter.OverloadCostTracker("list_flatten_int", trackListFlattenLegacy),
427 )
428 } else {
429 trackers = append(trackers,
430 interpreter.OverloadCostTracker("list_flatten", trackListFlatten),
431 interpreter.OverloadCostTracker("list_flatten_int", trackListFlatten),
432 )
433 }
434 for _, t := range comparableTypes {
435 trackers = append(trackers,
436 interpreter.OverloadCostTracker(
437 fmt.Sprintf("list_%s_sort", t.TypeName()),
438 trackListSort,
439 ),
440 interpreter.OverloadCostTracker(
441 fmt.Sprintf("list_%s_sortByAssociatedKeys", t.TypeName()),
442 trackListSortBy,
443 ),
444 )
445 }
446 opts = append(opts, cel.CostTrackerOptions(trackers...))
447 }
448 return opts
449}
450
451func genRange(n types.Int, maxSize int64) (ref.Val, error) {
452 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