FormatTypeReference formats a ResolvableTypeReference.
(ref ResolvableTypeReference)
| 165 | |
| 166 | // FormatTypeReference formats a ResolvableTypeReference. |
| 167 | func (ctx *FmtCtx) FormatTypeReference(ref ResolvableTypeReference) { |
| 168 | if ctx.HasFlags(fmtStaticallyFormatUserDefinedTypes) { |
| 169 | switch t := ref.(type) { |
| 170 | case *types.T: |
| 171 | if t.UserDefined() { |
| 172 | idRef := OIDTypeReference{OID: t.Oid()} |
| 173 | ctx.WriteString(idRef.SQLString()) |
| 174 | return |
| 175 | } |
| 176 | } |
| 177 | } |
| 178 | if idRef, ok := ref.(*OIDTypeReference); ok && ctx.indexedTypeFormatter != nil { |
| 179 | ctx.indexedTypeFormatter(ctx, idRef) |
| 180 | return |
| 181 | } |
| 182 | ctx.WriteString(ref.SQLString()) |
| 183 | } |
| 184 | |
| 185 | // GetStaticallyKnownType possibly promotes a ResolvableTypeReference into a |
| 186 | // *types.T if the reference is a statically known type. It is only safe to |
no test coverage detected