[FEATURE] - Improve EmailSender Interface to Use Pointer for SendEmail #12
Labels
enhancement
New feature or request
performance
Improvements related to the efficiency and speed of the code.
refactoring
Code refactoring to improve structure without changing functionality.
Is your feature request related to a problem? Please describe.
Currently, the
SendEmail
method in theEmailSender
interface accepts anEmailMessage
struct by value. This approach can be inefficient as it involves copying the entireEmailMessage
struct, which can be costly in terms of performance, especially when handling large messages or attachments.Describe the solution you'd like
The proposed solution is to modify the
SendEmail
method in theEmailSender
interface to accept a pointer toEmailMessage
instead of the struct by value. This change will enhance performance by avoiding unnecessary copying of the struct. The updated interface definition would be:Describe alternatives you've considered
An alternative approach would involve keeping the current method signature and optimizing other parts of the code. However, this would not address the fundamental inefficiency of copying the
EmailMessage
struct. Passing a pointer is a more straightforward and effective solution.Additional context
This feature will improve the performance of the
gomail
package by reducing the overhead associated with copying large structs. It aligns with Go best practices for handling large data structures and ensures more efficient memory usage. The implementation will include updates to existing tests and documentation to reflect this change.The text was updated successfully, but these errors were encountered: