Format implements the NodeFormatter interface.
(ctx *FmtCtx)
| 1057 | |
| 1058 | // Format implements the NodeFormatter interface. |
| 1059 | func (node *Subquery) Format(ctx *FmtCtx) { |
| 1060 | if ctx.HasFlags(FmtSymbolicSubqueries) { |
| 1061 | ctx.Printf("@S%d", node.Idx) |
| 1062 | } else { |
| 1063 | // Ensure that type printing is disabled during the recursion, as |
| 1064 | // the type annotations are not available in subqueries. |
| 1065 | ctx.WithFlags(ctx.flags & ^FmtShowTypes, func() { |
| 1066 | if node.Exists { |
| 1067 | ctx.WriteString("EXISTS ") |
| 1068 | } |
| 1069 | if node.Select == nil { |
| 1070 | // If the subquery is generated by the optimizer, we |
| 1071 | // don't have an actual statement. |
| 1072 | ctx.WriteString("<unknown>") |
| 1073 | } else { |
| 1074 | ctx.FormatNode(node.Select) |
| 1075 | } |
| 1076 | }) |
| 1077 | } |
| 1078 | } |
| 1079 | |
| 1080 | // BinaryOperator represents a binary operator. |
| 1081 | type BinaryOperator int |
nothing calls this directly
no test coverage detected