MCPcopy Create free account
hub / github.com/CrunchyData/postgres-operator / String

Method String

internal/pgbackrest/options.go:58–81  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

56type iniSectionSet map[string]iniMultiSet
57
58func (sections iniSectionSet) String() string {
59 global := make([]string, 0, len(sections))
60 stanza := make([]string, 0, len(sections))
61
62 for k := range sections {
63 if k == "global" || strings.HasPrefix(k, "global:") {
64 global = append(global, k)
65 } else {
66 stanza = append(stanza, k)
67 }
68 }
69
70 sort.Strings(global)
71 sort.Strings(stanza)
72
73 var b strings.Builder
74 for _, k := range global {
75 _, _ = fmt.Fprintf(&b, "\n[%s]\n%s", k, sections[k])
76 }
77 for _, k := range stanza {
78 _, _ = fmt.Fprintf(&b, "\n[%s]\n%s", k, sections[k])
79 }
80 return b.String()
81}

Callers 1

TestSectionSetFunction · 0.95

Calls 1

StringMethod · 0.45

Tested by 1

TestSectionSetFunction · 0.76