Documentation
¶
Index ¶
- Constants
- Variables
- func Module(extends ...di.Node) di.Node
- func NewFiberApp(config FiberConfig) *fiber.App
- func NewFiberAppWithOptions(config FiberConfig, opts ...FiberAppOption) *fiber.App
- func NopOtelMiddleware() di.Node
- func ParseBodyLimit(v string) (int, error)
- func ParseTLSMinVersion(v string) (uint16, error)
- func Priority(value PriorityLevel) di.Option
- func RegisterFiberApp(lc fx.Lifecycle, app *fiber.App, logger *zap.Logger, config Config)
- func RunFiberApp() di.Node
- func SetupHandlers(in setupHandlersIn)
- func UseBuildInfo(opts ...BuildInfoOption) di.Node
- func UseOtel() di.Node
- func UseSpa(opts ...SpaOption) di.Node
- func UseSwagger(opts ...SwaggerOption) di.Node
- type BuildInfoHandler
- type BuildInfoOption
- type Config
- type DateQuery
- type Error
- type ErrorDetail
- type FiberAppConfig
- type FiberAppOption
- type FiberConfig
- type FiberProxyConfig
- type Handler
- type ListenConfig
- type MockHandler
- type MockHandler_Expecter
- type MockHandler_Handle_Call
- type OtelMiddleware
- type PageQuery
- type PagedMeta
- type PagedResponse
- type PriorityLevel
- type Response
- type ServerConfig
- type SpaMiddleware
- type SpaOption
- type SwaggerHandler
- type SwaggerOption
- type TLSConfig
Constants ¶
View Source
const ( Earliest = di.Earliest Earlier = di.Earlier Normal = di.Normal Later = di.Later Latest = di.Latest )
View Source
const DefaultSpaDistPath = "web/dist"
Variables ¶
View Source
var HandlersGroupName = "us.handlers"
Functions ¶
func NewFiberApp ¶
func NewFiberApp(config FiberConfig) *fiber.App
func NewFiberAppWithOptions ¶ added in v1.9.2
func NewFiberAppWithOptions(config FiberConfig, opts ...FiberAppOption) *fiber.App
func NopOtelMiddleware ¶
func ParseBodyLimit ¶ added in v1.9.2
func ParseTLSMinVersion ¶ added in v1.9.2
func Priority ¶
func Priority(value PriorityLevel) di.Option
func RegisterFiberApp ¶
func RunFiberApp ¶ added in v1.5.0
func SetupHandlers ¶
func SetupHandlers(in setupHandlersIn)
func UseBuildInfo ¶
func UseBuildInfo(opts ...BuildInfoOption) di.Node
func UseSwagger ¶
func UseSwagger(opts ...SwaggerOption) di.Node
Types ¶
type BuildInfoHandler ¶
func NewBuildInfoHandler ¶
func NewBuildInfoHandler(opts ...BuildInfoOption) *BuildInfoHandler
type BuildInfoOption ¶
func WithDefaultPath ¶
func WithDefaultPath(path ...string) BuildInfoOption
type Config ¶
type Config struct {
Server ServerConfig `mapstructure:"server"`
Listen ListenConfig `mapstructure:"listen"`
TLS TLSConfig `mapstructure:"tls"`
}
type Error ¶
type Error struct {
Error ErrorDetail `json:"error"`
RequestID string `json:"request_id"`
}
type ErrorDetail ¶
type FiberAppConfig ¶ added in v1.9.2
type FiberAppConfig struct {
ServerHeader string `mapstructure:"server_header"`
BodyLimit string `mapstructure:"body_limit" default:"4MiB"`
ReadTimeout time.Duration `mapstructure:"read_timeout" default:"10s"`
WriteTimeout time.Duration `mapstructure:"write_timeout" default:"10s"`
IdleTimeout time.Duration `mapstructure:"idle_timeout" default:"60s"`
ReadBufferSize int `mapstructure:"read_buffer_size" default:"4096"`
WriteBufferSize int `mapstructure:"write_buffer_size" default:"4096"`
DisableKeepalive bool `mapstructure:"disable_keepalive" default:"false"`
EnableIPValidation bool `mapstructure:"enable_ip_validation" default:"true"`
}
type FiberAppOption ¶ added in v1.9.2
type FiberAppOption interface {
// contains filtered or unexported methods
}
func WithName ¶ added in v1.9.2
func WithName(name string) FiberAppOption
type FiberConfig ¶
type FiberConfig struct {
App FiberAppConfig `mapstructure:"app"`
Proxy FiberProxyConfig `mapstructure:"proxy"`
CaseSensitive bool `mapstructure:"case_sensitive" default:"false"`
StrictRouting bool `mapstructure:"strict_routing" default:"false"`
}
type FiberProxyConfig ¶ added in v1.9.2
type FiberProxyConfig struct {
TrustProxy bool `mapstructure:"trust_proxy" default:"false"`
ProxyHeader string `mapstructure:"proxy_header"`
TrustProxyConfig fiber.TrustProxyConfig `mapstructure:"trust_proxy_config"`
}
type ListenConfig ¶ added in v1.9.2
type ListenConfig struct {
ListenerNetwork string `mapstructure:"listener_network" default:"tcp"`
ShutdownTimeout time.Duration `mapstructure:"shutdown_timeout" default:"10s"`
DisableStartupMessage bool `mapstructure:"disable_startup_message" default:"false"`
EnablePrefork bool `mapstructure:"enable_prefork" default:"false"`
EnablePrintRoutes bool `mapstructure:"enable_print_routes" default:"false"`
}
type MockHandler ¶ added in v1.2.0
MockHandler is an autogenerated mock type for the Handler type
func NewMockHandler ¶ added in v1.2.0
func NewMockHandler(t interface {
mock.TestingT
Cleanup(func())
}) *MockHandler
NewMockHandler creates a new instance of MockHandler. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. The first argument is typically a *testing.T value.
func (*MockHandler) EXPECT ¶ added in v1.2.0
func (_m *MockHandler) EXPECT() *MockHandler_Expecter
func (*MockHandler) Handle ¶ added in v1.2.0
func (_mock *MockHandler) Handle(r fiber.Router)
Handle provides a mock function for the type MockHandler
type MockHandler_Expecter ¶ added in v1.2.0
type MockHandler_Expecter struct {
// contains filtered or unexported fields
}
func (*MockHandler_Expecter) Handle ¶ added in v1.2.0
func (_e *MockHandler_Expecter) Handle(r interface{}) *MockHandler_Handle_Call
Handle is a helper method to define mock.On call
- r fiber.Router
type MockHandler_Handle_Call ¶ added in v1.2.0
MockHandler_Handle_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Handle'
func (*MockHandler_Handle_Call) Return ¶ added in v1.2.0
func (_c *MockHandler_Handle_Call) Return() *MockHandler_Handle_Call
func (*MockHandler_Handle_Call) Run ¶ added in v1.2.0
func (_c *MockHandler_Handle_Call) Run(run func(r fiber.Router)) *MockHandler_Handle_Call
func (*MockHandler_Handle_Call) RunAndReturn ¶ added in v1.2.0
func (_c *MockHandler_Handle_Call) RunAndReturn(run func(r fiber.Router)) *MockHandler_Handle_Call
type OtelMiddleware ¶
func NewOtelMiddleware ¶
func NewOtelMiddleware(config otel.Config, lp *otel.LoggerProvider) *OtelMiddleware
func (*OtelMiddleware) Handle ¶
func (h *OtelMiddleware) Handle(r fiber.Router)
type PagedResponse ¶
type PriorityLevel ¶
type PriorityLevel = di.PriorityLevel
func Between ¶
func Between(lower, upper PriorityLevel) PriorityLevel
type ServerConfig ¶ added in v1.9.2
type SpaMiddleware ¶
type SpaMiddleware struct {
// contains filtered or unexported fields
}
func NewSpaMiddleware ¶
func NewSpaMiddlewareWithOptions ¶ added in v1.2.0
func NewSpaMiddlewareWithOptions(opts ...SpaOption) (*SpaMiddleware, error)
func (*SpaMiddleware) Handle ¶
func (s *SpaMiddleware) Handle(r fiber.Router)
type SpaOption ¶ added in v1.2.0
type SpaOption func(*spaOptions)
func WithSpaAssets ¶ added in v1.2.0
func WithSpaDistPath ¶ added in v1.2.0
func WithSpaLogger ¶ added in v1.2.0
type SwaggerHandler ¶
type SwaggerHandler struct {
// contains filtered or unexported fields
}
func NewSwaggerHandler ¶
func NewSwaggerHandler(config Config) (*SwaggerHandler, error)
func NewSwaggerHandlerWithOptions ¶ added in v1.2.0
func NewSwaggerHandlerWithOptions(opts ...SwaggerOption) (*SwaggerHandler, error)
func (*SwaggerHandler) Handle ¶
func (h *SwaggerHandler) Handle(r fiber.Router)
type SwaggerOption ¶ added in v1.2.0
type SwaggerOption func(*swaggerOptions)
func WithSwaggerConfig ¶ added in v1.2.0
func WithSwaggerConfig(config Config) SwaggerOption
func WithSwaggerPath ¶ added in v1.2.0
func WithSwaggerPath(path string) SwaggerOption
Source Files
¶
Click to show internal directories.
Click to hide internal directories.