rkfiberctx

package
v1.2.12 Latest Latest
Warning

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

Go to latest
Published: Dec 14, 2022 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Overview

Package rkfiberctx defines utility functions and variables used by fiber middleware

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddHeaderToClient

func AddHeaderToClient(ctx *fiber.Ctx, key, value string)

AddHeaderToClient headers that would be sent to client. Values would be merged.

func EndTraceSpan

func EndTraceSpan(ctx *fiber.Ctx, span trace.Span, success bool)

EndTraceSpan end span

func GetCsrfToken

func GetCsrfToken(ctx *fiber.Ctx) string

GetCsrfToken return csrf token if exists

func GetCursor added in v1.0.2

func GetCursor(ctx *fiber.Ctx) *rkcursor.Cursor

GetCursor create rkcursor.Cursor instance

func GetEntryName

func GetEntryName(ctx *fiber.Ctx) string

GetEntryName extract entry name from context.

func GetEvent

func GetEvent(ctx *fiber.Ctx) rkquery.Event

GetEvent extract takes the call-scoped EventData from middleware.

func GetIncomingHeaders

func GetIncomingHeaders(ctx *fiber.Ctx) *fasthttp.RequestHeader

GetIncomingHeaders extract call-scoped incoming headers

func GetJwtToken

func GetJwtToken(ctx *fiber.Ctx) *jwt.Token

GetJwtToken return jwt.Token if exists

func GetLogger

func GetLogger(ctx *fiber.Ctx) *zap.Logger

GetLogger extract takes the call-scoped zap logger from middleware.

func GetRequestId

func GetRequestId(ctx *fiber.Ctx) string

GetRequestId extract request id from context. If user enabled meta interceptor, then a random request Id would e assigned and set to context as value. If user called AddHeaderToClient() with key of RequestIdKey, then a new request id would be updated.

func GetTraceId

func GetTraceId(ctx *fiber.Ctx) string

GetTraceId extract trace id from context.

func GetTraceSpan

func GetTraceSpan(ctx *fiber.Ctx) trace.Span

GetTraceSpan extract the call-scoped span from context.

func GetTracer

func GetTracer(ctx *fiber.Ctx) trace.Tracer

GetTracer extract the call-scoped tracer from context.

func GetTracerPropagator

func GetTracerPropagator(ctx *fiber.Ctx) propagation.TextMapPropagator

GetTracerPropagator extract takes the call-scoped propagator from middleware.

func GetTracerProvider

func GetTracerProvider(ctx *fiber.Ctx) trace.TracerProvider

GetTracerProvider extract the call-scoped tracer provider from context.

func GormCtx added in v1.2.5

func GormCtx(ctx *fiber.Ctx) context.Context

func InjectSpanToHttpRequest

func InjectSpanToHttpRequest(ctx *fiber.Ctx, req *http.Request)

InjectSpanToHttpRequest inject span to http request

func NewTraceSpan

func NewTraceSpan(ctx *fiber.Ctx, name string) trace.Span

NewTraceSpan start a new span

func SetHeaderToClient

func SetHeaderToClient(ctx *fiber.Ctx, key, value string)

SetHeaderToClient headers that would be sent to client. Values would be overridden.

Types

This section is empty.

Jump to

Keyboard shortcuts

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