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

Method ProgramOptions

ext/strings.go:622–647  ·  view source on GitHub ↗

ProgramOptions implements the Library interface method.

()

Source from the content-addressed store, hash-verified

620
621// ProgramOptions implements the Library interface method.
622func (lib *stringLib) ProgramOptions() []cel.ProgramOption {
623 if lib.version >= 5 {
624 return []cel.ProgramOption{
625 cel.CostTrackerOptions(
626 interpreter.OverloadCostTracker("string_char_at_int", trackStringCharAtCost),
627 interpreter.OverloadCostTracker("string_index_of_string", trackStringSearchCost),
628 interpreter.OverloadCostTracker("string_index_of_string_int", trackStringSearchCost),
629 interpreter.OverloadCostTracker("string_last_index_of_string", trackStringSearchCost),
630 interpreter.OverloadCostTracker("string_last_index_of_string_int", trackStringSearchCost),
631 interpreter.OverloadCostTracker("string_lower_ascii", trackStringTransformCost),
632 interpreter.OverloadCostTracker("string_upper_ascii", trackStringTransformCost),
633 interpreter.OverloadCostTracker("string_replace_string_string", trackStringReplaceCost),
634 interpreter.OverloadCostTracker("string_replace_string_string_int", trackStringReplaceCost),
635 interpreter.OverloadCostTracker("string_split_string", trackStringSplitCost),
636 interpreter.OverloadCostTracker("string_split_string_int", trackStringSplitCost),
637 interpreter.OverloadCostTracker("string_substring_int", trackStringTransformCost),
638 interpreter.OverloadCostTracker("string_substring_int_int", trackStringTransformCost),
639 interpreter.OverloadCostTracker("string_trim", trackStringTransformCost),
640 interpreter.OverloadCostTracker("string_reverse", trackStringTransformCost),
641 interpreter.OverloadCostTracker("list_join", trackStringJoinCost),
642 interpreter.OverloadCostTracker("list_join_string", trackStringJoinCost),
643 ),
644 }
645 }
646 return []cel.ProgramOption{}
647}
648
649func charAt(str string, ind int64) (string, error) {
650 i := int(ind)

Callers

nothing calls this directly

Calls 2

CostTrackerOptionsFunction · 0.92
OverloadCostTrackerFunction · 0.92

Tested by

no test coverage detected