ProgramOptions implements the Library interface method.
()
| 620 | |
| 621 | // ProgramOptions implements the Library interface method. |
| 622 | func (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 | |
| 649 | func charAt(str string, ind int64) (string, error) { |
| 650 | i := int(ind) |
nothing calls this directly
no test coverage detected