-
Notifications
You must be signed in to change notification settings - Fork 85
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
[#120] Implement IoC Container #115
Conversation
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## master #115 +/- ##
==========================================
- Coverage 53.06% 52.26% -0.80%
==========================================
Files 105 117 +12
Lines 7570 8099 +529
==========================================
+ Hits 4017 4233 +216
- Misses 3268 3566 +298
- Partials 285 300 +15
☔ View full report in Codecov by Sentry. |
facades/artisan.go
Outdated
func NewArtisan() console.Artisan { | ||
return App().MakeArtisan() | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Temporarily add NewArtisan
, will replace Artisan
: func NewArtisan() console.Artisan
facades/config.go
Outdated
var Config = NewConfig() | ||
|
||
func NewConfig() configcontract.Config { | ||
return App().MakeConfig() | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Temporarily add NewArtisan
, will replace Config
: func Config() configcontract.Config
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks no problems.
"github.com/goravel/framework/contracts/http" | ||
"github.com/goravel/framework/facades" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All of the modules shouldn't be dependent on facades and should inject if needed.
} | ||
|
||
func (s *AuthTestSuite) TestLoginUsingID_EmptySecret() { | ||
mockConfig := mock.Config() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All of the test cases shouldn't be dependent on the github.com/goravel/framework/testing/mock
package, will cause import cycle error, use &cachemock.Cache{}
instead.
app.Singleton(BindingAuth, func() (any, error) { | ||
config := app.MakeConfig() | ||
return NewAuth(config.GetString("auth.defaults.guard"), | ||
app.MakeCache(), config, app.MakeOrm()), nil | ||
}) | ||
app.Singleton(BindingGate, func() (any, error) { | ||
return access.NewGate(context.Background()), nil | ||
}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bind and inject like this.
database/gorm/wire.go
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use wire to implement dependency injection.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
* Optimize service container * Adaptation Crypt module * Adaptation Cache module * Adaptation contracts * Adaptation Event module * Adaptation Foundation module * Adaptation Queue module * Adaptation DB module * Adaptation filesystem module * Adaptation filesystem module * Adaptation facades module * Adaptation Auth module * Adaptation Http module * Adaptation Grpc module * Adaptation Log module * Adaptation Mail module * Adaptation Route module * Adaptation Schedule module * Adaptation Filesystem module * Adaptation other module * Adaptation Hash module * Fix unit tests * Optimize code * Add unit tests * Rebase * Optimize unit tests
Close: goravel/goravel#120