-
Notifications
You must be signed in to change notification settings - Fork 69
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactor Senders initialization #797
Labels
Comments
Merged
Dimedrolity
changed the title
Refactor Senders configuration
Refactor Senders initialization
Nov 10, 2022
Dimedrolity
added a commit
that referenced
this issue
Nov 11, 2022
Use constructor function NewSender instead of Init method, remove Init method from Sender interface.
Dimedrolity
added a commit
that referenced
this issue
Nov 11, 2022
Use constructor function NewSender instead of Init method, remove Init method from Sender interface.
Dimedrolity
added a commit
that referenced
this issue
Nov 11, 2022
Use constructor function NewSender instead of Init method, remove Init method from Sender interface.
Dimedrolity
added a commit
that referenced
this issue
Nov 11, 2022
Use constructor function NewSender instead of Init method, remove Init method from Sender interface.
Dimedrolity
added a commit
that referenced
this issue
Nov 14, 2022
Use constructor function NewSender instead of Init method, remove Init method from Sender interface.
Dimedrolity
added a commit
that referenced
this issue
Dec 1, 2022
Use constructor function NewSender instead of Init method, remove Init method from Sender interface.
Dimedrolity
added a commit
that referenced
this issue
Dec 6, 2022
Use constructor function NewSender instead of Init method, remove Init method from Sender interface.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Overview
We have Sender interface with Init method that configures Sender.
Problem
It is strange approach to configure entity, each Sender can have its own settings and dependencies.
Now we have
logger, location *time.Location, dateTimeFormat string
, I think authors (developers) wanted to don't repeat yourself and created that unified Init method. Maybe will be better extract BaseConfig struct and maybe Config struct for each Sender.If we follow DI principle, then constructor func (that have dependencies) and Init method in one time is not well, both methods goal is to configure.
Solution
Need to create constructor functions for each Sender, and move init logic from Init method to constructors, then remove Init from interface and impelementrations.
The text was updated successfully, but these errors were encountered: