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

Method ExecuteFuncString

pkg/util/fasttemplate/template.go:170–179  ·  view source on GitHub ↗

ExecuteFuncString calls f on each template tag (placeholder) occurrence and substitutes it with the data written to TagFunc's w. Returns the resulting string. This function is optimized for frozen templates. Use ExecuteFuncString for constantly changing templates.

(f TagFunc)

Source from the content-addressed store, hash-verified

168// This function is optimized for frozen templates.
169// Use ExecuteFuncString for constantly changing templates.
170func (t *Template) ExecuteFuncString(f TagFunc) []byte {
171 bb := t.byteBufferPool.Get()
172 if _, err := t.ExecuteFunc(bb, f); err != nil {
173 return []byte{}
174 }
175 s := bb.Bytes()
176 bb.Reset()
177 t.byteBufferPool.Put(bb)
178 return s
179}
180
181// ExecuteString substitutes template tags (placeholders) with the corresponding
182// values from the map m and returns the result.

Callers 1

ExecuteStringMethod · 0.95

Calls 4

ExecuteFuncMethod · 0.95
GetMethod · 0.65
PutMethod · 0.65
ResetMethod · 0.45

Tested by

no test coverage detected