MCPcopy Create free account
hub / github.com/auxten/postgresql-parser / Format

Method Format

pkg/sql/sem/tree/expr.go:423–435  ·  view source on GitHub ↗

Format implements the NodeFormatter interface.

(ctx *FmtCtx)

Source from the content-addressed store, hash-verified

421
422// Format implements the NodeFormatter interface.
423func (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.
438func NewTypedComparisonExpr(op ComparisonOperator, left, right TypedExpr) *ComparisonExpr {

Callers

nothing calls this directly

Calls 4

binExprFmtWithParenFunction · 0.85
hasSubOperatorMethod · 0.80
StringMethod · 0.65

Tested by

no test coverage detected