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