MCPcopy Create free account
hub / github.com/TheThingsNetwork/lorawan-stack / FormatMessage

Method FormatMessage

pkg/errors/message_format.go:22–40  ·  view source on GitHub ↗

FormatMessage formats the message using the given attributes.

(attributes map[string]any)

Source from the content-addressed store, hash-verified

20
21// FormatMessage formats the message using the given attributes.
22func (d *Definition) FormatMessage(attributes map[string]any) string {
23 if d == nil {
24 return ""
25 }
26 if len(attributes) == 0 {
27 return d.messageFormat
28 }
29 parsedMessageFormat := d.parsedMessageFormat
30 if parsedMessageFormat == nil {
31 parsedMessageFormat, _ = formatter.Parse(d.messageFormat)
32 }
33 if parsedMessageFormat != nil {
34 formatted, err := parsedMessageFormat.FormatMap(attributes)
35 if err == nil {
36 return formatted
37 }
38 }
39 return d.messageFormat
40}

Callers 3

appendValidationErrorsFunction · 0.80
StringMethod · 0.80
ServeHTTPMethod · 0.80

Calls 1

ParseMethod · 0.65

Tested by

no test coverage detected