This commit is contained in:
binwiederhier
2026-01-08 20:57:55 -05:00
parent 5ad3de2904
commit 37d71051de
3 changed files with 36 additions and 52 deletions

View File

@@ -65,6 +65,17 @@ func (m *message) Context() log.Context {
return fields
}
// forJSON returns a copy of the message suitable for JSON output.
// It clears the SequenceID if it equals the ID to reduce redundancy.
func (m *message) forJSON() *message {
if m.SequenceID == m.ID {
clone := *m
clone.SequenceID = ""
return &clone
}
return m
}
type attachment struct {
Name string `json:"name"`
Type string `json:"type,omitempty"`