Format implements the NodeFormatter interface.
(ctx *FmtCtx)
| 984 | |
| 985 | // Format implements the NodeFormatter interface. |
| 986 | func (node *Subquery) Format(ctx *FmtCtx) { |
| 987 | if ctx.HasFlags(FmtSymbolicSubqueries) { |
| 988 | ctx.Printf("@S%d", node.Idx) |
| 989 | } else { |
| 990 | // Ensure that type printing is disabled during the recursion, as |
| 991 | // the type annotations are not available in subqueries. |
| 992 | ctx.WithFlags(ctx.flags & ^FmtShowTypes, func() { |
| 993 | if node.Exists { |
| 994 | ctx.WriteString("EXISTS ") |
| 995 | } |
| 996 | if node.Select == nil { |
| 997 | // If the subquery is generated by the optimizer, we |
| 998 | // don't have an actual statement. |
| 999 | ctx.WriteString("<unknown>") |
| 1000 | } else { |
| 1001 | ctx.FormatNode(node.Select) |
| 1002 | } |
| 1003 | }) |
| 1004 | } |
| 1005 | } |
| 1006 | |
| 1007 | // TypedDummy is a dummy expression that represents a dummy value with |
| 1008 | // a specified type. It can be used in situations where TypedExprs of a |
nothing calls this directly
no test coverage detected