Documentation
¶
Index ¶
- Variables
- func URLTagResolver(fieldname, token string) (*structproto.Tag, error)
- type ComponentBinder
- type CorsMiddleware
- type ErrorHandlerMiddleware
- func (m *ErrorHandlerMiddleware) CanSetSuccessor() bool
- func (m *ErrorHandlerMiddleware) Init(app *host.AppModule)
- func (m *ErrorHandlerMiddleware) OnInitComplete()
- func (m *ErrorHandlerMiddleware) OnStart(ctx any) error
- func (m *ErrorHandlerMiddleware) OnStop(ctx any) error
- func (m *ErrorHandlerMiddleware) ProcessRequest(w http.ResponseWriter, r *http.Request, state internal.RequestState, ...)
- func (m *ErrorHandlerMiddleware) SetSuccessor(successor internal.RequestHandleModule)
- type EventEvidence
- type EventLog
- type LoggingMiddleware
- func (m *LoggingMiddleware) CanSetSuccessor() bool
- func (m *LoggingMiddleware) Init(app *host.AppModule)
- func (m *LoggingMiddleware) OnInitComplete()
- func (m *LoggingMiddleware) OnStart(ctx any) error
- func (m *LoggingMiddleware) OnStop(ctx any) error
- func (m *LoggingMiddleware) ProcessRequest(w http.ResponseWriter, r *http.Request, state internal.RequestState, ...)
- func (m *LoggingMiddleware) SetSuccessor(successor internal.RequestHandleModule)
- type LoggingService
- type NoopEventLog
- func (l *NoopEventLog) Flush()
- func (l *NoopEventLog) OnError(w http.ResponseWriter, r *http.Request, err any, stackTrace []byte)
- func (l *NoopEventLog) OnProcessRequest(w http.ResponseWriter, r *http.Request)
- func (l *NoopEventLog) OnProcessRequestComplete(w http.ResponseWriter, r *http.Request, statusCode int)
- type NoopLoggingService
- type RequestHandlerBinder
- type RequestManagerMiddleware
- type TracingMiddleware
- func (m *TracingMiddleware) CanSetSuccessor() bool
- func (m *TracingMiddleware) Init(app *host.AppModule)
- func (m *TracingMiddleware) OnInitComplete()
- func (m *TracingMiddleware) OnStart(ctx context.Context) error
- func (m *TracingMiddleware) OnStop(ctx context.Context) error
- func (m *TracingMiddleware) ProcessRequest(w http.ResponseWriter, r *http.Request, state internal.RequestState, ...)
- func (m *TracingMiddleware) SetSuccessor(successor internal.RequestHandleModule)
Constants ¶
This section is empty.
Variables ¶
var ( TAG_URL = "url" TAG_OPT_EXPAND_ENV = "@ExpandEnv" TAG_OPT_BIND_METHOD = "@BindMethod" )
Functions ¶
func URLTagResolver ¶
func URLTagResolver(fieldname, token string) (*structproto.Tag, error)
Types ¶
type ComponentBinder ¶
type ComponentBinder struct {
// contains filtered or unexported fields
}
ComponentBinder performs dependency injection of components.
func (*ComponentBinder) Bind ¶
func (b *ComponentBinder) Bind(field structproto.FieldInfo, rv reflect.Value) error
func (*ComponentBinder) Deinit ¶
func (b *ComponentBinder) Deinit(context *structproto.StructProtoContext) error
func (*ComponentBinder) Init ¶
func (b *ComponentBinder) Init(context *structproto.StructProtoContext) error
type CorsMiddleware ¶
type CorsMiddleware struct {
CustomHeaders []string
}
CorsMiddleware provides CORS functionality.
func (*CorsMiddleware) AddCustomHeaders ¶
func (m *CorsMiddleware) AddCustomHeaders(headers ...string) *CorsMiddleware
AddCustomHeaders dynamically adds more custom headers to the middleware.
func (*CorsMiddleware) Init ¶
func (m *CorsMiddleware) Init(app *host.AppModule)
Init implements host.Middleware.
type ErrorHandlerMiddleware ¶
type ErrorHandlerMiddleware struct {
Handler internal.ErrorHandler
}
func (*ErrorHandlerMiddleware) CanSetSuccessor ¶
func (m *ErrorHandlerMiddleware) CanSetSuccessor() bool
func (*ErrorHandlerMiddleware) Init ¶
func (m *ErrorHandlerMiddleware) Init(app *host.AppModule)
func (*ErrorHandlerMiddleware) OnInitComplete ¶
func (m *ErrorHandlerMiddleware) OnInitComplete()
func (*ErrorHandlerMiddleware) OnStart ¶
func (m *ErrorHandlerMiddleware) OnStart(ctx any) error
func (*ErrorHandlerMiddleware) OnStop ¶
func (m *ErrorHandlerMiddleware) OnStop(ctx any) error
func (*ErrorHandlerMiddleware) ProcessRequest ¶
func (m *ErrorHandlerMiddleware) ProcessRequest( w http.ResponseWriter, r *http.Request, state internal.RequestState, recover *internal.Recover, )
func (*ErrorHandlerMiddleware) SetSuccessor ¶
func (m *ErrorHandlerMiddleware) SetSuccessor(successor internal.RequestHandleModule)
type EventEvidence ¶
type EventEvidence interface {
GetMethod() string
GetPath() string
GetRemoteAddr() string
GetStatusCode() int
}
EventEvidence interface for event evidence.
type EventLog ¶
type EventLog interface {
OnError(w http.ResponseWriter, r *http.Request, err any, stackTrace []byte)
OnProcessRequest(w http.ResponseWriter, r *http.Request)
OnProcessRequestComplete(w http.ResponseWriter, r *http.Request, statusCode int)
Flush()
}
EventLog interface for simplified event logging.
type LoggingMiddleware ¶
type LoggingMiddleware struct {
LoggingService LoggingService
}
LoggingMiddleware provides logging functionality.
func (*LoggingMiddleware) CanSetSuccessor ¶
func (m *LoggingMiddleware) CanSetSuccessor() bool
CanSetSuccessor indicates this middleware supports successor chaining.
func (*LoggingMiddleware) Init ¶
func (m *LoggingMiddleware) Init(app *host.AppModule)
Init initializes the middleware with application module.
func (*LoggingMiddleware) OnInitComplete ¶
func (m *LoggingMiddleware) OnInitComplete()
OnInitComplete is called after all components are initialized.
func (*LoggingMiddleware) OnStart ¶
func (m *LoggingMiddleware) OnStart(ctx any) error
OnStart is called when the host starts.
func (*LoggingMiddleware) OnStop ¶
func (m *LoggingMiddleware) OnStop(ctx any) error
OnStop is called when the host stops.
func (*LoggingMiddleware) ProcessRequest ¶
func (m *LoggingMiddleware) ProcessRequest( w http.ResponseWriter, r *http.Request, state internal.RequestState, recover *internal.Recover, )
ProcessRequest handles request processing for logging middleware.
func (*LoggingMiddleware) SetSuccessor ¶
func (m *LoggingMiddleware) SetSuccessor(successor internal.RequestHandleModule)
SetSuccessor sets the next middleware in the processing chain.
type LoggingService ¶
type LoggingService interface {
ConfigureLogger(logger any)
CreateEventLog(ev EventEvidence) EventLog
}
LoggingService interface for basic functionality
var NoopLoggingServiceSingleton LoggingService = &NoopLoggingService{}
NoopLoggingServiceSingleton is an empty logging service singleton.
type NoopEventLog ¶
type NoopEventLog struct{}
NoopEventLog provides a no-op event log implementation
func (*NoopEventLog) Flush ¶
func (l *NoopEventLog) Flush()
func (*NoopEventLog) OnError ¶
func (l *NoopEventLog) OnError(w http.ResponseWriter, r *http.Request, err any, stackTrace []byte)
func (*NoopEventLog) OnProcessRequest ¶
func (l *NoopEventLog) OnProcessRequest(w http.ResponseWriter, r *http.Request)
func (*NoopEventLog) OnProcessRequestComplete ¶
func (l *NoopEventLog) OnProcessRequestComplete(w http.ResponseWriter, r *http.Request, statusCode int)
type NoopLoggingService ¶
type NoopLoggingService struct{}
NoopLoggingService provides a no-op implementation
func (*NoopLoggingService) ConfigureLogger ¶
func (s *NoopLoggingService) ConfigureLogger(logger any)
func (*NoopLoggingService) CreateEventLog ¶
func (s *NoopLoggingService) CreateEventLog(ev EventEvidence) EventLog
type RequestHandlerBinder ¶
type RequestHandlerBinder struct {
// contains filtered or unexported fields
}
func (*RequestHandlerBinder) Bind ¶
func (b *RequestHandlerBinder) Bind(field structproto.FieldInfo, rv reflect.Value) error
func (*RequestHandlerBinder) Deinit ¶
func (b *RequestHandlerBinder) Deinit(context *structproto.StructProtoContext) error
func (*RequestHandlerBinder) Init ¶
func (b *RequestHandlerBinder) Init(context *structproto.StructProtoContext) error
type RequestManagerMiddleware ¶
type RequestManagerMiddleware struct {
RequestManager any
}
func (*RequestManagerMiddleware) Init ¶
func (m *RequestManagerMiddleware) Init(app *host.AppModule)
Init implements host.Middleware.
type TracingMiddleware ¶
type TracingMiddleware struct {
TracerService *internal.RequestTracerService
SkipPaths []string
SkipMethods []string
MergeCORSTrace bool
// contains filtered or unexported fields
}
TracingMiddleware provides comprehensive tracing with OpenTelemetry and slog fallback
func (*TracingMiddleware) CanSetSuccessor ¶
func (m *TracingMiddleware) CanSetSuccessor() bool
CanSetSuccessor indicates this middleware supports successor chaining
func (*TracingMiddleware) Init ¶
func (m *TracingMiddleware) Init(app *host.AppModule)
Init initializes the middleware with application module
func (*TracingMiddleware) OnInitComplete ¶
func (m *TracingMiddleware) OnInitComplete()
OnInitComplete is called after all components are initialized
func (*TracingMiddleware) OnStart ¶
func (m *TracingMiddleware) OnStart(ctx context.Context) error
OnStart is called when the host starts
func (*TracingMiddleware) OnStop ¶
func (m *TracingMiddleware) OnStop(ctx context.Context) error
OnStop is called when the host stops
func (*TracingMiddleware) ProcessRequest ¶
func (m *TracingMiddleware) ProcessRequest( w http.ResponseWriter, r *http.Request, state internal.RequestState, recover *internal.Recover, )
ProcessRequest implements the request processing with comprehensive tracing
func (*TracingMiddleware) SetSuccessor ¶
func (m *TracingMiddleware) SetSuccessor(successor internal.RequestHandleModule)
SetSuccessor sets the next middleware in the processing chain