MCPcopy Create free account
hub / github.com/cockroachdb/cockroachdb-parser / DebugString

Method DebugString

pkg/sql/types/types.go:2820–2835  ·  view source on GitHub ↗

DebugString returns a detailed dump of the type protobuf struct, suitable for debugging scenarios.

()

Source from the content-addressed store, hash-verified

2818// DebugString returns a detailed dump of the type protobuf struct, suitable for
2819// debugging scenarios.
2820func (t *T) DebugString() string {
2821 if t.Family() == ArrayFamily && t.ArrayContents().UserDefined() {
2822 // In the case that this type is an array that contains a user defined
2823 // type, the introspection that protobuf performs to generate a string
2824 // representation will panic if the UserDefinedTypeMetadata field of the
2825 // type is populated. It seems to not understand that fields in the element
2826 // T could be not generated by proto, and panics trying to operate on the
2827 // TypeMeta field of the T. To get around this, we just deep copy the T and
2828 // zero out the type metadata to placate proto. See the following issue for
2829 // details: https://github.com/gogo/protobuf/issues/693.
2830 internalTypeCopy := protoutil.Clone(&t.InternalType).(*InternalType)
2831 internalTypeCopy.ArrayContents.TypeMeta = UserDefinedTypeMetadata{}
2832 return internalTypeCopy.String()
2833 }
2834 return t.InternalType.String()
2835}
2836
2837// IsAmbiguous returns true if this type is in UnknownFamily or AnyFamily.
2838// Instances of ambiguous types can be NULL or be in one of several different

Callers

nothing calls this directly

Calls 5

FamilyMethod · 0.95
ArrayContentsMethod · 0.95
CloneFunction · 0.92
UserDefinedMethod · 0.80
StringMethod · 0.65

Tested by

no test coverage detected