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)
| 604 | // 'my-principal-group' in request.auth.claims && |
| 605 | // request.auth.claims.iat > now - duration('5m') |
| 606 | func 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. |
no outgoing calls