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

Function WrapOnColumn

parser/unparser.go:606–614  ·  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

604// 'my-principal-group' in request.auth.claims &&
605// request.auth.claims.iat > now - duration('5m')
606func WrapOnColumn(col int) UnparserOption {
607 return func(opt *unparserOption) (*unparserOption, error) {
608 if col < 1 {
609 return nil, fmt.Errorf("Invalid unparser option. Wrap column value must be greater than or equal to 1. Got %v instead", col)
610 }
611 opt.wrapOnColumn = col
612 return opt, nil
613 }
614}
615
616// WrapOnOperators specifies which operators to perform word wrapping on an output expression when its string length
617// exceeds the column limit set by WrapOnColumn function.

Callers 4

reportCoverageFunction · 0.92
TestUnparseFunction · 0.85
TestUnparseErrorsFunction · 0.85

Calls

no outgoing calls

Tested by 2

TestUnparseFunction · 0.68
TestUnparseErrorsFunction · 0.68