Format implements the NodeFormatter interface.
(ctx *FmtCtx)
| 968 | |
| 969 | // Format implements the NodeFormatter interface. |
| 970 | func (node *Subquery) Format(ctx *FmtCtx) { |
| 971 | if ctx.HasFlags(FmtSymbolicSubqueries) { |
| 972 | ctx.Printf("@S%d", node.Idx) |
| 973 | } else { |
| 974 | // Ensure that type printing is disabled during the recursion, as |
| 975 | // the type annotations are not available in subqueries. |
| 976 | ctx.WithFlags(ctx.flags & ^FmtShowTypes, func() { |
| 977 | if node.Exists { |
| 978 | ctx.WriteString("EXISTS ") |
| 979 | } |
| 980 | if node.Select == nil { |
| 981 | // If the subquery is generated by the optimizer, we |
| 982 | // don't have an actual statement. |
| 983 | ctx.WriteString("<unknown>") |
| 984 | } else { |
| 985 | ctx.FormatNode(node.Select) |
| 986 | } |
| 987 | }) |
| 988 | } |
| 989 | } |
| 990 | |
| 991 | // TypedDummy is a dummy expression that represents a dummy value with |
| 992 | // a specified type. It can be used in situations where TypedExprs of a |
nothing calls this directly
no test coverage detected