web

package
v1.2.1 Latest Latest
Warning

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

Go to latest
Published: Feb 6, 2026 License: MIT Imports: 20 Imported by: 0

Documentation

Index

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 Module

func Module(extends ...di.Node) di.Node

func NewFiberApp

func NewFiberApp(config FiberConfig) *fiber.App

func NopOtelMiddleware

func NopOtelMiddleware() di.Node

func Priority

func Priority(value PriorityLevel) di.Option

func RegisterFiberApp

func RegisterFiberApp(lc fx.Lifecycle, app *fiber.App, logger *zap.Logger, config Config)

func SetupHandlers

func SetupHandlers(in setupHandlersIn)

func UseBuildInfo

func UseBuildInfo(opts ...BuildInfoOption) di.Node

func UseMqttWebsocket

func UseMqttWebsocket(opts ...realtime.Option) di.Node

func UseSpa

func UseSpa(opts ...SpaOption) di.Node

func UseSwagger

func UseSwagger(opts ...SwaggerOption) di.Node

Types

type BuildInfoHandler

type BuildInfoHandler = buildinfo.Handler

func NewBuildInfoHandler

func NewBuildInfoHandler(opts ...BuildInfoOption) *BuildInfoHandler

type BuildInfoOption

type BuildInfoOption = buildinfo.Option

func WithDefaultPath

func WithDefaultPath(path ...string) BuildInfoOption

type Config

type Config struct {
	Host string `mapstructure:"host"`
	Port int    `mapstructure:"port"`
}

type DateQuery

type DateQuery struct {
	FromDate time.Time `query:"from_date" json:"from_date"`
	ToDate   time.Time `query:"to_date" json:"to_date"`
}

type Error

type Error struct {
	Error     ErrorDetail `json:"error"`
	RequestID string      `json:"request_id"`
}

type ErrorDetail

type ErrorDetail struct {
	Code    string   `json:"code"`
	Message string   `json:"message"`
	Details []string `json:"details"`
}

type FiberConfig

type FiberConfig struct {
	Name string `mapstructure:"name"`
}

type Handler

type Handler interface {
	Handle(r fiber.Router)
}

type MockHandler added in v1.2.0

type MockHandler struct {
	mock.Mock
}

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

type MockHandler_Handle_Call struct {
	*mock.Call
}

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 (*MockHandler_Handle_Call) Run added in v1.2.0

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

type OtelMiddleware struct {
	otel.Telemetry
	// contains filtered or unexported fields
}

func NewOtelMiddleware

func NewOtelMiddleware(config otel.Config, lp *otel.LoggerProvider) *OtelMiddleware

func (*OtelMiddleware) Handle

func (h *OtelMiddleware) Handle(r fiber.Router)

type PageQuery

type PageQuery struct {
	Page  int `query:"page" json:"page"`
	Limit int `query:"limit" json:"limit"`
}

type PagedMeta

type PagedMeta struct {
	Page       int  `json:"page,omitempty"`
	Limit      int  `json:"limit,omitempty"`
	TotalItems int  `json:"total_items,omitempty"`
	TotalPages int  `json:"total_pages,omitempty"`
	HasNext    bool `json:"has_next,omitempty"`
	HasPrev    bool `json:"has_prev,omitempty"`
}

type PagedResponse

type PagedResponse struct {
	Data any       `json:"data,omitempty"`
	Meta PagedMeta `json:"meta"`
}

type PriorityLevel

type PriorityLevel = di.PriorityLevel

func Between

func Between(lower, upper PriorityLevel) PriorityLevel

type Response

type Response struct {
	Data any `json:"data,omitempty"`
	Meta any `json:"meta,omitempty"`
}

type SpaMiddleware

type SpaMiddleware struct {
	// contains filtered or unexported fields
}

func NewSpaMiddleware

func NewSpaMiddleware(assets *embed.FS, log *zap.Logger) (*SpaMiddleware, error)

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 WithSpaAssets(assets *embed.FS) SpaOption

func WithSpaDistPath added in v1.2.0

func WithSpaDistPath(path string) SpaOption

func WithSpaLogger added in v1.2.0

func WithSpaLogger(log *zap.Logger) SpaOption

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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