Documentation
¶
Overview ¶
Package internal contains internal Fiber adapter implementation details not exposed as part of the public web package API.
Index ¶
- type Adapter
- type AdapterOption
- type Context
- type ErrorHandlerInfo
- type ErrorHandlerRegistry
- type HandlerFunc
- type RouteInfo
- type RouteRegistry
- func (r *RouteRegistry) AllControllersHaveRoutes() bool
- func (r *RouteRegistry) GetGeneratedRoutes(controller string) []RouteInfo
- func (r *RouteRegistry) GetRoutesForController(controller string) ([]RouteInfo, bool)
- func (r *RouteRegistry) HasGeneratedRoutes(controller string) bool
- func (r *RouteRegistry) RegisterGeneratedRoutes(controller string, routes ...RouteInfo) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Adapter ¶
type Adapter interface {
Start(addr string) error
Stop(ctx context.Context) error
RegisterRoute(method, path string, handler HandlerFunc) error
ServeHTTP(req *http.Request) (*http.Response, error)
}
Adapter is the internal contract that the public web package uses.
func NewAdapter ¶
func NewAdapter(opts ...AdapterOption) Adapter
NewAdapter creates a Fiber-backed adapter.
type AdapterOption ¶
type AdapterOption func(*adapterOptions)
AdapterOption configures a fiberAdapter.
func WithTracerProvider ¶
func WithTracerProvider(tp trace.TracerProvider) AdapterOption
WithTracerProvider installs an OTel TracerProvider in the adapter. When non-nil, a tracing middleware is added before all routes.
type Context ¶
type Context interface {
Method() string
Path() string
OriginalURL() string
Param(key string) string
Query(key string) string
Header(key string) string
IP() string
Body() []byte
Status(code int)
SetHeader(key, value string)
Send(body []byte) error
JSON(body any) error
Context() context.Context
Locals(key string, value ...any) any
}
Context mirrors the public web.Context contract without importing web and creating a package cycle.
type ErrorHandlerInfo ¶
type ErrorHandlerInfo struct {
ErrorType string // Name of the error type
Controller string // Name of the handler/controller type
MethodName string // Name of the handler method
Handler interface{} // Handler function
}
ErrorHandlerInfo contains metadata about a generated error handler registration.
type ErrorHandlerRegistry ¶
type ErrorHandlerRegistry struct {
// contains filtered or unexported fields
}
ErrorHandlerRegistry stores generated error handler registrations.
func GlobalErrorHandlerRegistry ¶
func GlobalErrorHandlerRegistry() *ErrorHandlerRegistry
GlobalErrorHandlerRegistry returns the global error handler registry instance.
func (*ErrorHandlerRegistry) GetErrorHandlersForHandler ¶
func (r *ErrorHandlerRegistry) GetErrorHandlersForHandler(handlerName string) ([]ErrorHandlerInfo, bool)
GetErrorHandlersForHandler retrieves all error handlers for a handler.
func (*ErrorHandlerRegistry) HasGeneratedErrorHandlers ¶
func (r *ErrorHandlerRegistry) HasGeneratedErrorHandlers() bool
HasGeneratedErrorHandlers checks if any error handlers are registered.
func (*ErrorHandlerRegistry) RegisterGeneratedErrorHandlers ¶
func (r *ErrorHandlerRegistry) RegisterGeneratedErrorHandlers(handlers ...ErrorHandlerInfo) error
RegisterGeneratedErrorHandlers registers error handlers. This is called by generated code during app initialization.
type HandlerFunc ¶
HandlerFunc handles a request through the internal adapter.
type RouteInfo ¶
type RouteInfo struct {
Method string // HTTP method (GET, POST, etc.)
Path string // URL path
Handler interface{}
Controller string // Name of the controller type
HandlerName string // Name of the handler method
Guards []string // Names of guards to apply
Interceptors []string // Names of interceptors to apply
}
RouteInfo contains metadata about a generated route registration.
type RouteRegistry ¶
type RouteRegistry struct {
// contains filtered or unexported fields
}
RouteRegistry stores generated route registrations.
func GlobalRouteRegistry ¶
func GlobalRouteRegistry() *RouteRegistry
GlobalRouteRegistry returns the global route registry instance.
func (*RouteRegistry) AllControllersHaveRoutes ¶
func (r *RouteRegistry) AllControllersHaveRoutes() bool
AllControllersHaveRoutes checks if any controller has registered routes.
func (*RouteRegistry) GetGeneratedRoutes ¶
func (r *RouteRegistry) GetGeneratedRoutes(controller string) []RouteInfo
GetGeneratedRoutes retrieves routes for a controller from the registry.
func (*RouteRegistry) GetRoutesForController ¶
func (r *RouteRegistry) GetRoutesForController(controller string) ([]RouteInfo, bool)
GetRoutesForController retrieves all routes for a controller.
func (*RouteRegistry) HasGeneratedRoutes ¶
func (r *RouteRegistry) HasGeneratedRoutes(controller string) bool
HasGeneratedRoutes checks if a controller has registered generated routes.
func (*RouteRegistry) RegisterGeneratedRoutes ¶
func (r *RouteRegistry) RegisterGeneratedRoutes(controller string, routes ...RouteInfo) error
RegisterGeneratedRoutes registers routes for a given controller. This is called by generated code during app initialization.