MCPcopy Index your code
hub / github.com/dnote/dnote / Execute

Method Execute

pkg/server/mailer/mailer.go:121–133  ·  view source on GitHub ↗

Execute executes the template and returns the subject, body, and any error

(name, kind string, data any)

Source from the content-addressed store, hash-verified

119
120// Execute executes the template and returns the subject, body, and any error
121func (tmpl Templates) Execute(name, kind string, data any) (subject, body string, err error) {
122 t, err := tmpl.get(name, kind)
123 if err != nil {
124 return "", "", errors.Wrap(err, "getting template")
125 }
126
127 buf := new(bytes.Buffer)
128 if err := t.tmpl.Execute(buf, data); err != nil {
129 return "", "", errors.Wrap(err, "executing the template")
130 }
131
132 return t.subject, buf.String(), nil
133}

Callers 3

TestResetPasswordEmailFunction · 0.95
TestWelcomeEmailFunction · 0.95

Calls 2

getMethod · 0.95
ExecuteMethod · 0.65

Tested by 3

TestResetPasswordEmailFunction · 0.76
TestWelcomeEmailFunction · 0.76