MCPcopy
hub / github.com/kopia/kopia / ToString

Method ToString

notification/sender/notification_message.go:79–95  ·  view source on GitHub ↗

ToString returns a string representation of the message.

()

Source from the content-addressed store, hash-verified

77
78// ToString returns a string representation of the message.
79func (m Message) ToString() string {
80 var buf bytes.Buffer
81
82 fmt.Fprintf(&buf, "Subject: %v\n", m.Subject)
83
84 headers := slices.AppendSeq(make([]string, 0, len(m.Headers)), maps.Keys(m.Headers))
85
86 sort.Strings(headers)
87
88 for _, k := range headers {
89 fmt.Fprintf(&buf, "%v: %v\n", k, m.Headers[k])
90 }
91
92 fmt.Fprintf(&buf, "\n%v", m.Body)
93
94 return buf.String()
95}
96
97// Supported message formats.
98const (

Callers 2

TestToStringFunction · 0.95
TestParseMessageFunction · 0.80

Calls 1

StringMethod · 0.45

Tested by 2

TestToStringFunction · 0.76
TestParseMessageFunction · 0.64