(cfg *SQLGenerator, a BooleanNode, not bool, other Node)
| 69 | } |
| 70 | |
| 71 | func boolEqualsSQLString(cfg *SQLGenerator, a BooleanNode, not bool, other Node) (string, error) { |
| 72 | switch other.UseAs().(type) { |
| 73 | case BooleanNode: |
| 74 | bn, ok := other.(BooleanNode) |
| 75 | if !ok { |
| 76 | return "", xerrors.Errorf("not a boolean node: %T", other) |
| 77 | } |
| 78 | |
| 79 | // Always wrap both sides in parens to ensure the correct precedence. |
| 80 | return fmt.Sprintf("%s %s %s", |
| 81 | BoolParenthesis(a).SQLString(cfg), |
| 82 | equalsOp(not), |
| 83 | BoolParenthesis(bn).SQLString(cfg), |
| 84 | ), nil |
| 85 | default: |
| 86 | return "", xerrors.Errorf("unsupported equality: %T %s %T", a, equalsOp(not), other) |
| 87 | } |
| 88 | } |
| 89 | |
| 90 | // nolint:revive |
| 91 | func equalsOp(not bool) string { |
no test coverage detected