Format implements the NodeFormatter interface.
(ctx *FmtCtx)
| 421 | |
| 422 | // Format implements the NodeFormatter interface. |
| 423 | func (node *ComparisonExpr) Format(ctx *FmtCtx) { |
| 424 | opStr := node.Operator.String() |
| 425 | if node.Operator == IsDistinctFrom && (node.Right == DNull || node.Right == DBoolTrue || node.Right == DBoolFalse) { |
| 426 | opStr = "IS NOT" |
| 427 | } else if node.Operator == IsNotDistinctFrom && (node.Right == DNull || node.Right == DBoolTrue || node.Right == DBoolFalse) { |
| 428 | opStr = "IS" |
| 429 | } |
| 430 | if node.Operator.hasSubOperator() { |
| 431 | binExprFmtWithParenAndSubOp(ctx, node.Left, node.SubOperator.String(), opStr, node.Right) |
| 432 | } else { |
| 433 | binExprFmtWithParen(ctx, node.Left, opStr, node.Right, true) |
| 434 | } |
| 435 | } |
| 436 | |
| 437 | // NewTypedComparisonExpr returns a new ComparisonExpr that is verified to be well-typed. |
| 438 | func NewTypedComparisonExpr(op ComparisonOperator, left, right TypedExpr) *ComparisonExpr { |
nothing calls this directly
no test coverage detected