47fac22230
- .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>
1.6 KiB
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_with_attachment | function | go | infra | 1.0.0 | pure | func EmailWithAttachment(msg EmailMessage, att EmailAttachment) EmailMessage | Retorna una copia del EmailMessage con el adjunto añadido al final. No muta el mensaje original. |
|
|
|
false |
|
nuevo EmailMessage con todos los campos del original mas el adjunto añadido | true |
|
functions/infra/email_build_test.go | functions/infra/email_with_attachment.go |
Ejemplo
msg := EmailBuildHTML("alice@example.com", []string{"bob@example.com"}, "Informe", "<p>Ver adjunto</p>")
att := EmailAttachment{Filename: "report.pdf", ContentType: "application/pdf", Data: pdfBytes}
msg2 := EmailWithAttachment(msg, att)
// len(msg.Attachments) == 0 (original no mutado)
// len(msg2.Attachments) == 1
Notas
Funcion pura. Implementa el patron immutable builder — cada llamada retorna un nuevo EmailMessage con copia profunda de todos los slices y mapas. Se puede encadenar varias veces para agregar multiples adjuntos.