MCPcopy Create free account
hub / github.com/TalkingData/owl / fillTemplate

Function fillTemplate

controller/notify.go:292–305  ·  view source on GitHub ↗

根据模板对象填充模板

(raw_template string, template_obj notifyTemplate)

Source from the content-addressed store, hash-verified

290
291//根据模板对象填充模板
292func fillTemplate(raw_template string, template_obj notifyTemplate) string {
293 var filled_template bytes.Buffer
294 tmpl, err := template.New("template").Parse(raw_template)
295 if err != nil {
296 lg.Error(err.Error())
297 return err.Error()
298 }
299 err = tmpl.Execute(&filled_template, template_obj)
300 if err != nil {
301 lg.Error(err.Error())
302 return err.Error()
303 }
304 return filled_template.String()
305}
306
307//根据报警事件生成报警模板对象
308func generateTemplateObj(strategy_event *types.StrategyEvent, trigger_events map[string]*types.TriggerEvent) notifyTemplate {

Callers 2

doAlarmActionFunction · 0.85
doRestoreActionFunction · 0.85

Calls 1

StringMethod · 0.45

Tested by

no test coverage detected