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

Function parseAndFormatClauseV2

ext/formatting_v2.go:721–734  ·  view source on GitHub ↗

parseAndFormatClause parses the format clause at the start of the given string with val, and returns how many characters were consumed and the substituted string form of val, or an error if one occurred.

(formatStr string, val ref.Val, callback formatStringInterpolatorV2, list formatListArgs, maxPrecision int)

Source from the content-addressed store, hash-verified

719// parseAndFormatClause parses the format clause at the start of the given string with val, and returns
720// how many characters were consumed and the substituted string form of val, or an error if one occurred.
721func parseAndFormatClauseV2(formatStr string, val ref.Val, callback formatStringInterpolatorV2, list formatListArgs, maxPrecision int) (int, string, error) {
722 i := 1
723 read, formatter, err := parseFormattingClauseV2(formatStr[i:], callback, maxPrecision)
724 i += read
725 if err != nil {
726 return -1, "", newParseFormatError("could not parse formatting clause", err)
727 }
728
729 valStr, err := formatter(val)
730 if err != nil {
731 return -1, "", newParseFormatError("error during formatting", err)
732 }
733 return i, valStr, nil
734}
735
736func parseFormattingClauseV2(formatStr string, callback formatStringInterpolatorV2, maxPrecision int) (int, clauseImplV2, error) {
737 i := 0

Callers 1

parseFormatStringV2Function · 0.85

Calls 3

parseFormattingClauseV2Function · 0.85
newParseFormatErrorFunction · 0.85
formatterFuncType · 0.85

Tested by

no test coverage detected