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

Function WrapOnColumn

parser/unparser.go:678–686  ·  view source on GitHub ↗

WrapOnColumn wraps the output expression when its string length exceeds a specified limit for operators set by WrapOnOperators function or by default, "&&" and "||" will be wrapped. Example usage: Unparse(expr, sourceInfo, WrapOnColumn(40), WrapOnOperators(Operators.LogicalAnd)) This will insert

(col int)

Source from the content-addressed store, hash-verified

676// 'my-principal-group' in request.auth.claims &&
677// request.auth.claims.iat > now - duration('5m')
678func WrapOnColumn(col int) UnparserOption {
679 return func(opt *unparserOption) (*unparserOption, error) {
680 if col < 1 {
681 return nil, fmt.Errorf("Invalid unparser option. Wrap column value must be greater than or equal to 1. Got %v instead", col)
682 }
683 opt.wrapOnColumn = col
684 return opt, nil
685 }
686}
687
688// WrapOnOperators specifies which operators to perform word wrapping on an output expression when its string length
689// exceeds the column limit set by WrapOnColumn function.

Callers 5

reportCoverageFunction · 0.92
FormatWrapOnColumnFunction · 0.92
TestUnparseFunction · 0.85
TestUnparseErrorsFunction · 0.85

Calls

no outgoing calls

Tested by 2

TestUnparseFunction · 0.68
TestUnparseErrorsFunction · 0.68