Files
fn_registry/functions/infra/email_template_render.md
T
egutierrez 47fac22230 chore: auto-commit (799 archivos)
- .claude/CLAUDE.md
- .claude/commands/subagentes.md
- .claude/rules/INDEX.md
- .mcp.json
- bash/functions/cybersecurity/analyze_dns.md
- bash/functions/cybersecurity/audit_http_headers.md
- bash/functions/cybersecurity/audit_ssh_config.md
- bash/functions/cybersecurity/check_firewall.md
- bash/functions/cybersecurity/detect_suspicious_users.md
- bash/functions/cybersecurity/encrypt_file.md
- ...

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-14 00:28:20 +02:00

1.6 KiB

name, kind, lang, domain, version, purity, signature, description, tags, uses_functions, uses_types, returns, returns_optional, error_type, imports, params, output, tested, tests, test_file_path, file_path
name kind lang domain version purity signature description tags uses_functions uses_types returns returns_optional error_type imports params output tested tests test_file_path file_path
email_template_render function go infra 1.0.0 impure func EmailTemplateRender(tmplStr string, data map[string]any) (string, error) Renderiza un Go text/template con el data map dado y retorna el string resultante. Falla si el template tiene sintaxis invalida o si la ejecucion produce un error.
email
template
render
text/template
pendiente-usar
false error_go_core
bytes
fmt
text/template
name desc
tmplStr fuente del template en sintaxis Go text/template (ej: 'Hola {{.Name}}')
name desc
data mapa de variables disponibles dentro del template (clave string, valor any)
string resultado del template renderizado con los datos provistos true
renderiza template simple con datos
sustituye multiples variables
error en template invalido
template vacio retorna string vacio
functions/infra/email_template_render_test.go functions/infra/email_template_render.go

Ejemplo

tmpl := "Hola {{.Name}}, tu pedido {{.OrderID}} esta listo."
body, err := EmailTemplateRender(tmpl, map[string]any{
    "Name":    "Alice",
    "OrderID": "ORD-1234",
})
// body = "Hola Alice, tu pedido ORD-1234 esta listo."

Notas

Usa text/template de la stdlib de Go. Para HTML con escape automatico usar html/template en su lugar. Util para generar el body de emails con datos dinamicos antes de llamar a EmailBuildHTML o EmailBuildText.