Skip to content
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

fix: dependency error #659

Merged
merged 2 commits into from
Sep 29, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
85 changes: 84 additions & 1 deletion contracts/foundation/application.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,32 @@ package foundation
import (
"context"

"github.com/goravel/framework/contracts/auth"
"github.com/goravel/framework/contracts/auth/access"
"github.com/goravel/framework/contracts/cache"
"github.com/goravel/framework/contracts/config"
"github.com/goravel/framework/contracts/console"
"github.com/goravel/framework/contracts/crypt"
"github.com/goravel/framework/contracts/database/migration"
"github.com/goravel/framework/contracts/database/orm"
"github.com/goravel/framework/contracts/database/seeder"
"github.com/goravel/framework/contracts/event"
"github.com/goravel/framework/contracts/filesystem"
"github.com/goravel/framework/contracts/grpc"
"github.com/goravel/framework/contracts/hash"
"github.com/goravel/framework/contracts/http"
"github.com/goravel/framework/contracts/log"
"github.com/goravel/framework/contracts/mail"
"github.com/goravel/framework/contracts/queue"
"github.com/goravel/framework/contracts/route"
"github.com/goravel/framework/contracts/schedule"
"github.com/goravel/framework/contracts/session"
"github.com/goravel/framework/contracts/testing"
"github.com/goravel/framework/contracts/translation"
"github.com/goravel/framework/contracts/validation"
)

type Application interface {
Container
// Boot register and bootstrap configured service providers.
Boot()
// Commands register the given commands with the console application.
Expand Down Expand Up @@ -42,4 +63,66 @@ type Application interface {
SetJson(json Json)
// GetJson get the JSON implementation.
GetJson() Json

// Container
// Bind registers a binding with the container.
Bind(key any, callback func(app Application) (any, error))
// BindWith registers a binding with the container.
BindWith(key any, callback func(app Application, parameters map[string]any) (any, error))
// Instance registers an existing instance as shared in the container.
Instance(key, instance any)
// Make resolves the given type from the container.
Make(key any) (any, error)
// MakeArtisan resolves the artisan console instance.
MakeArtisan() console.Artisan
// MakeAuth resolves the auth instance.
MakeAuth(ctx http.Context) auth.Auth
// MakeCache resolves the cache instance.
MakeCache() cache.Cache
// MakeConfig resolves the config instance.
MakeConfig() config.Config
// MakeCrypt resolves the crypt instance.
MakeCrypt() crypt.Crypt
// MakeEvent resolves the event instance.
MakeEvent() event.Instance
// MakeGate resolves the gate instance.
MakeGate() access.Gate
// MakeGrpc resolves the grpc instance.
MakeGrpc() grpc.Grpc
// MakeHash resolves the hash instance.
MakeHash() hash.Hash
// MakeLang resolves the lang instance.
MakeLang(ctx context.Context) translation.Translator
// MakeLog resolves the log instance.
MakeLog() log.Log
// MakeMail resolves the mail instance.
MakeMail() mail.Mail
// MakeOrm resolves the orm instance.
MakeOrm() orm.Orm
// MakeQueue resolves the queue instance.
MakeQueue() queue.Queue
// MakeRateLimiter resolves the rate limiter instance.
MakeRateLimiter() http.RateLimiter
// MakeRoute resolves the route instance.
MakeRoute() route.Route
// MakeSchedule resolves the schedule instance.
MakeSchedule() schedule.Schedule
// MakeSchema resolves the schema instance.
MakeSchema() migration.Schema
// MakeSession resolves the session instance.
MakeSession() session.Manager
// MakeStorage resolves the storage instance.
MakeStorage() filesystem.Storage
// MakeTesting resolves the testing instance.
MakeTesting() testing.Testing
// MakeValidation resolves the validation instance.
MakeValidation() validation.Validation
// MakeView resolves the view instance.
MakeView() http.View
// MakeSeeder resolves the seeder instance.
MakeSeeder() seeder.Facade
// MakeWith resolves the given type with the given parameters from the container.
MakeWith(key any, parameters map[string]any) (any, error)
// Singleton registers a shared binding in the container.
Singleton(key any, callback func(app Application) (any, error))
hwbrzzl marked this conversation as resolved.
Show resolved Hide resolved
}
92 changes: 0 additions & 92 deletions contracts/foundation/container.go

This file was deleted.

30 changes: 0 additions & 30 deletions contracts/foundation/service_provider_test.go

This file was deleted.

10 changes: 5 additions & 5 deletions foundation/application.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"strings"

"github.com/goravel/framework/config"
consolecontract "github.com/goravel/framework/contracts/console"
contractsconsole "github.com/goravel/framework/contracts/console"
hwbrzzl marked this conversation as resolved.
Show resolved Hide resolved
"github.com/goravel/framework/contracts/foundation"
"github.com/goravel/framework/foundation/console"
"github.com/goravel/framework/foundation/json"
Expand Down Expand Up @@ -38,7 +38,7 @@
}

type Application struct {
foundation.Container
*Container
publishes map[string]map[string]string
publishGroups map[string]map[string]string
json foundation.Json
Expand All @@ -52,7 +52,7 @@
func (app *Application) Boot() {
app.registerConfiguredServiceProviders()
app.bootConfiguredServiceProviders()
app.registerCommands([]consolecontract.Command{
app.registerCommands([]contractsconsole.Command{

Check warning on line 55 in foundation/application.go

View check run for this annotation

Codecov / codecov/patch

foundation/application.go#L55

Added line #L55 was not covered by tests
console.NewTestMakeCommand(),
console.NewPackageMakeCommand(),
console.NewVendorPublishCommand(app.publishes, app.publishGroups),
Expand All @@ -61,7 +61,7 @@
app.bootArtisan()
}

func (app *Application) Commands(commands []consolecontract.Command) {
func (app *Application) Commands(commands []contractsconsole.Command) {

Check warning on line 64 in foundation/application.go

View check run for this annotation

Codecov / codecov/patch

foundation/application.go#L64

Added line #L64 was not covered by tests
app.registerCommands(commands)
}

Expand Down Expand Up @@ -209,7 +209,7 @@
}
}

func (app *Application) registerCommands(commands []consolecontract.Command) {
func (app *Application) registerCommands(commands []contractsconsole.Command) {

Check warning on line 212 in foundation/application.go

View check run for this annotation

Codecov / codecov/patch

foundation/application.go#L212

Added line #L212 was not covered by tests
app.MakeArtisan().Register(commands)
}

Expand Down
Loading
Loading