MCPcopy Create free account
hub / github.com/dolthub/doltgresql / FormatTypeReference

Method FormatTypeReference

postgres/parser/sem/tree/type_name.go:167–183  ·  view source on GitHub ↗

FormatTypeReference formats a ResolvableTypeReference.

(ref ResolvableTypeReference)

Source from the content-addressed store, hash-verified

165
166// FormatTypeReference formats a ResolvableTypeReference.
167func (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

Callers 4

FormatNodeMethod · 0.95
FormatMethod · 0.80
FormatMethod · 0.80
FormatMethod · 0.80

Calls 6

HasFlagsMethod · 0.95
SQLStringMethod · 0.95
UserDefinedMethod · 0.80
OidMethod · 0.80
WriteStringMethod · 0.80
SQLStringMethod · 0.65

Tested by

no test coverage detected