foundation

package
v1.14.9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 12, 2024 License: MIT Imports: 23 Imported by: 75

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Application

type Application interface {
	Container
	// Boot register and bootstrap configured service providers.
	Boot()
	// Commands register the given commands with the console application.
	Commands([]console.Command)
	// Path gets the path respective to "app" directory.
	Path(path string) string
	// BasePath get the base path of the Goravel installation.
	BasePath(path string) string
	// ConfigPath get the path to the configuration files.
	ConfigPath(path string) string
	// DatabasePath get the path to the database directory.
	DatabasePath(path string) string
	// StoragePath get the path to the storage directory.
	StoragePath(path string) string
	// LangPath get the path to the language files.
	LangPath(path string) string
	// PublicPath get the path to the public directory.
	PublicPath(path string) string
	// ExecutablePath get the path to the executable of the running Goravel application.
	ExecutablePath() (string, error)
	// Publishes register the given paths to be published by the "vendor:publish" command.
	Publishes(packageName string, paths map[string]string, groups ...string)
	// CurrentLocale get the current application locale.
	CurrentLocale(ctx context.Context) string
	// SetLocale set the current application locale.
	SetLocale(ctx context.Context, locale string) context.Context
	// Version gets the version number of the application.
	Version() string
	// IsLocale get the current application locale.
	IsLocale(ctx context.Context, locale string) bool
	// SetJson set the JSON implementation.
	SetJson(json Json)
	// GetJson get the JSON implementation.
	GetJson() Json
}

type BaseServiceProvider added in v1.13.0

type BaseServiceProvider struct{}

BaseServiceProvider is a default implementation of the Provider interface.

func (*BaseServiceProvider) Boot added in v1.13.0

func (*BaseServiceProvider) Register added in v1.13.0

func (s *BaseServiceProvider) Register(Application)

type Container

type Container interface {
	// 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
	// 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))
}

type Json added in v1.14.0

type Json interface {
	// Marshal serializes the given value to a JSON-encoded byte slice.
	Marshal(any) ([]byte, error)
	// Unmarshal deserializes the given JSON-encoded byte slice into the provided value.
	Unmarshal([]byte, any) error
}

type ServiceProvider

type ServiceProvider interface {
	// Register any application services.
	Register(app Application)
	// Boot any application services after register.
	Boot(app Application)
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL