MCPcopy Create free account
hub / github.com/rabbitstack/fibratus / stdTagFunc

Function stdTagFunc

pkg/util/fasttemplate/template.go:195–210  ·  view source on GitHub ↗
(w io.Writer, tag string, m map[string]interface{})

Source from the content-addressed store, hash-verified

193}
194
195func stdTagFunc(w io.Writer, tag string, m map[string]interface{}) (int, error) {
196 v := m[tag]
197 if v == nil {
198 return 0, nil
199 }
200 switch value := v.(type) {
201 case []byte:
202 return w.Write(value)
203 case string:
204 return w.Write([]byte(value))
205 case TagFunc:
206 return value(w, tag)
207 default:
208 return 0, fmt.Errorf("tag=%q contains unexpected value type=%#v. Expected []byte, string or TagFunc", tag, v)
209 }
210}

Callers 2

ExecuteMethod · 0.85
ExecuteStringMethod · 0.85

Calls 1

WriteMethod · 0.65

Tested by

no test coverage detected