web

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Feb 3, 2026 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var HandlersGroupName = "us.handlers"

Functions

func HandleSpa

func HandleSpa(r fiber.Router, s *SpaMiddleware)

func Module

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

func NewFiberApp

func NewFiberApp(config FiberConfig) *fiber.App

func NopOtelMiddleware

func NopOtelMiddleware() di.Node

func NopSpa

func NopSpa() 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 RegisterMqttToWebsocket

func RegisterMqttToWebsocket(ms *realtime.MqttServer, ws *realtime.Websocket) error

func SetupHandlers

func SetupHandlers(attached otel.Attached, app *fiber.App, handlers ...Handler)

func UseBuildInfo

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

func UseMqttWebsocket

func UseMqttWebsocket() di.Node

func UseSpa

func UseSpa(assets *embed.FS) di.Node

func UseSwagger

func UseSwagger() 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 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 int
const (
	Earliest PriorityLevel = -200
	Earlier  PriorityLevel = -100
	Normal   PriorityLevel = 0
	Later    PriorityLevel = 100
	Latest   PriorityLevel = 200
)

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 (*SpaMiddleware) Handle

func (s *SpaMiddleware) Handle(r fiber.Router)

type SwaggerHandler

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

func NewSwaggerHandler

func NewSwaggerHandler(config Config) (*SwaggerHandler, error)

func (*SwaggerHandler) Handle

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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