MCPcopy
hub / github.com/jackc/pgx / joinFieldNames

Function joinFieldNames

rows.go:752–772  ·  view source on GitHub ↗
(fldDescs []pgconn.FieldDescription)

Source from the content-addressed store, hash-verified

750}
751
752func joinFieldNames(fldDescs []pgconn.FieldDescription) string {
753 switch len(fldDescs) {
754 case 0:
755 return ""
756 case 1:
757 return fldDescs[0].Name
758 }
759
760 totalSize := len(fldDescs) - 1 // Space for separator bytes.
761 for _, d := range fldDescs {
762 totalSize += len(d.Name)
763 }
764 var b strings.Builder
765 b.Grow(totalSize)
766 b.WriteString(fldDescs[0].Name)
767 for _, d := range fldDescs[1:] {
768 b.WriteByte(0) // Join with NUL byte as it's (presumably) not a valid column character.
769 b.WriteString(d.Name)
770 }
771 return b.String()
772}
773
774func computeNamedStructFields(
775 fldDescs []pgconn.FieldDescription,

Callers 1

lookupNamedStructFieldsFunction · 0.85

Calls 1

StringMethod · 0.45

Tested by

no test coverage detected