libFiber

package
v0.22.0 Latest Latest
Warning

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

Go to latest
Published: Dec 23, 2025 License: GPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const FiberCtxKey = "fiber.Ctx"

Variables

This section is empty.

Functions

func AddSpanAttribute added in v0.18.0

func AddSpanAttribute(c *fiber.Ctx, key, value string)

AddSpanAttribute adds an attribute to the current span in Fiber context

func AddSpanAttributes added in v0.18.0

func AddSpanAttributes(c *fiber.Ctx, attrs map[string]string)

AddSpanAttributes adds multiple attributes to the current span

func AddSpanEvent added in v0.18.0

func AddSpanEvent(c *fiber.Ctx, name string, attrs map[string]string)

AddSpanEvent adds an event to the current span

func CustomTracingMiddleware added in v0.18.0

func CustomTracingMiddleware(tm *libTracing.TracingManager) fiber.Handler

CustomTracingMiddleware creates a custom Fiber middleware with more control

func ErrorHandler

func ErrorHandler(path, title string, handler ContextInitiator) fiber.ErrorHandler

func ExtendMap

func ExtendMap(mp map[string]string) map[string][]string

func Fiber

func Fiber(handler any) func(c *fiber.Ctx) error

func GetSpanFromContext added in v0.18.0

func GetSpanFromContext(c *fiber.Ctx) trace.Span

GetSpanFromContext gets the span from Fiber context

func RecordSpanError added in v0.18.0

func RecordSpanError(c *fiber.Ctx, err error, attrs map[string]string)

RecordSpanError records an error in the current span

func TracingMiddleware added in v0.18.0

func TracingMiddleware() fiber.Handler

TracingMiddleware creates Fiber middleware for OpenTelemetry tracing using official otelfiber

Types

type ContextInitiator added in v0.7.2

type ContextInitiator interface {
	InitContext(c *fiber.Ctx) webFramework.WebFramework
	Respond(int, int, string, any, bool, webFramework.WebFramework)
}

type FiberParser

type FiberParser struct {
	Ctx *fiber.Ctx
}

func InitContext

func InitContext(c *fiber.Ctx) FiberParser

func (FiberParser) Abort added in v0.7.0

func (c FiberParser) Abort() error

func (FiberParser) AddCustomAttributes added in v0.13.2

func (c FiberParser) AddCustomAttributes(attr slog.Attr)

func (FiberParser) AddSpanAttribute added in v0.18.0

func (c FiberParser) AddSpanAttribute(key, value string)

func (FiberParser) AddSpanAttributes added in v0.18.0

func (c FiberParser) AddSpanAttributes(attrs map[string]string)

func (FiberParser) AddSpanEvent added in v0.18.0

func (c FiberParser) AddSpanEvent(name string, attrs map[string]string)

func (FiberParser) CheckUrlParam

func (c FiberParser) CheckUrlParam(name string) (string, bool)

func (FiberParser) FileAttachment added in v0.10.4

func (c FiberParser) FileAttachment(path, fileName string)

func (FiberParser) FormValue added in v0.10.1

func (c FiberParser) FormValue(name string) string

func (FiberParser) GetArgs

func (c FiberParser) GetArgs(args ...any) map[string]string

func (FiberParser) GetBody

func (c FiberParser) GetBody(target any) error

func (FiberParser) GetContext added in v0.22.0

func (c FiberParser) GetContext() context.Context

GetContext returns the context from the Fiber context

func (FiberParser) GetHeader

func (c FiberParser) GetHeader(target webFramework.HeaderInterface) error

func (FiberParser) GetHeaderValue

func (c FiberParser) GetHeaderValue(name string) string

func (FiberParser) GetHttpHeader

func (c FiberParser) GetHttpHeader() http.Header

func (FiberParser) GetLocal

func (c FiberParser) GetLocal(name string) any

func (FiberParser) GetLocalString

func (c FiberParser) GetLocalString(name string) string

func (FiberParser) GetMethod

func (c FiberParser) GetMethod() string

func (FiberParser) GetPath

func (c FiberParser) GetPath() string

func (FiberParser) GetRawUrlQuery

func (c FiberParser) GetRawUrlQuery() string

func (FiberParser) GetTraceContext added in v0.18.0

func (c FiberParser) GetTraceContext() trace.SpanContext

Tracing methods for FiberParser

func (FiberParser) GetUri added in v0.5.7

func (c FiberParser) GetUri(target any) error

func (FiberParser) GetUrlParam

func (c FiberParser) GetUrlParam(name string) string

func (FiberParser) GetUrlParams

func (c FiberParser) GetUrlParams() map[string]string

func (FiberParser) GetUrlQuery

func (c FiberParser) GetUrlQuery(target any) error

func (FiberParser) Next added in v0.7.0

func (c FiberParser) Next() error

func (FiberParser) ParseCommand

func (c FiberParser) ParseCommand(command, title string, request webFramework.RecordData, parser webFramework.FieldParser) string

func (FiberParser) RecordSpanError added in v0.18.0

func (c FiberParser) RecordSpanError(err error, attrs map[string]string)

func (FiberParser) SaveFile added in v0.10.1

func (c FiberParser) SaveFile(
	formTagName, path string,
) error

func (FiberParser) SendJSONRespBody added in v0.7.0

func (c FiberParser) SendJSONRespBody(status int, resp any) error

func (FiberParser) SetContext added in v0.22.0

func (c FiberParser) SetContext(ctx context.Context)

SetContext updates the context in the Fiber context

func (FiberParser) SetLocal

func (c FiberParser) SetLocal(name string, value any)

func (FiberParser) SetReqHeader added in v0.7.5

func (c FiberParser) SetReqHeader(name string, value string)

func (FiberParser) SetRespHeader added in v0.10.28

func (c FiberParser) SetRespHeader(name string, value string)

func (FiberParser) SetTraceContext added in v0.18.0

func (c FiberParser) SetTraceContext(spanCtx trace.SpanContext)

func (FiberParser) StartSpan added in v0.18.0

func (c FiberParser) StartSpan(name string, opts ...trace.SpanStartOption) (context.Context, trace.Span)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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