app

package
v0.10.1 Latest Latest
Warning

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

Go to latest
Published: Feb 14, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ServiceProvider added in v0.10.0

type ServiceProvider interface {
	// Register binds services into the container. Called before any Boot method.
	Register(s *Services) error

	// Boot is called after all providers have been registered.
	// Use this to resolve cross-provider dependencies.
	Boot(s *Services) error

	// Shutdown gracefully tears down provider resources.
	// Called in reverse registration order.
	Shutdown(ctx context.Context) error
}

ServiceProvider defines the lifecycle contract for modular service registration. Providers are called in two phases: Register (bind services) then Boot (wire them). Shutdown is called in reverse registration order during application teardown.

type Services

type Services struct {
	DB         *orm.Manager
	Log        log.Logger
	Cache      *cache.Manager
	Crypto     crypto.Encryptor
	Events     events.Dispatcher
	Queue      queue.Driver
	Storage    *storage.Manager
	Scheduler  *scheduler.Scheduler
	Mail       mail.Mailer
	Exceptions *exceptions.Handler
	Validator  validation.Validator

	// These use `any` to break import cycles (auth/csrf/view import router).
	// Use typed accessors on velocity.App or router.Context.
	Auth any // *auth.Manager
	CSRF any // *csrf.CSRF
	View any // *view.Engine
}

Services holds references to all framework service instances. Both the root velocity package and the router package import this leaf package, avoiding import cycles.

Fields typed as `any` break import cycles for packages that import the router package (auth, csrf, view). The root velocity.App and the router.Context provide typed accessors for these.

Jump to

Keyboard shortcuts

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