Documentation ¶
Index ¶
- Constants
- func ContextLoad(data *ContextData) context.Context
- func ContextWithMethod(ctx context.Context, method string) context.Context
- func ContextWithPath(ctx context.Context, path string) context.Context
- func ContextWithRawQuery(ctx context.Context, rawQuery string) context.Context
- func ContextWithRequestID(ctx context.Context, requestID string) context.Context
- func ContextWithValue(value *ContextValue) context.Context
- func Register(engine *gin.Engine, ...)
- type ContextData
- type ContextValue
Constants ¶
View Source
const ( LegoRequestID = "lego-request-id" LegoRequestMethod = "lego-request-method" LegoRequestPath = "lego-request-path" LegoRequestRawQuery = "lego-request-rawquery" LegoHandlerErr = "lego-handler-err" LegoHandlerMsg = "lego-handler-msg" HandleCrash = "handle crash" HandleError = "handle error" BeforeHandleError = "before handle error" BehindHandleError = "behind handle error" )
常量
Variables ¶
This section is empty.
Functions ¶
func ContextWithMethod ¶
ContextWithMethod returns a new Context that carries value u.
func ContextWithPath ¶
ContextWithPath returns a new Context that carries value u.
func ContextWithRawQuery ¶
ContextWithRawQuery returns a new Context that carries value u.
func ContextWithRequestID ¶
ContextWithRequestID returns a new Context that carries value u.
func ContextWithValue ¶
func ContextWithValue(value *ContextValue) context.Context
ContextWithValue returns a new Context that carries value u.
Types ¶
type ContextData ¶
type ContextData struct { Value *ContextValue `json:"value,omitempty"` Deadline int64 `json:"deadline,omitempty"` }
ContextData 传输用
type ContextValue ¶
type ContextValue struct { RequestID string `json:"request_id,omitempty"` // 服务端ID Method string `json:"method,omitempty"` Path string `json:"path,omitempty"` RawQuery string `json:"raw_query,omitempty"` }
ContextValue 上下文结构体
func ContextFetchValue ¶
func ContextFetchValue(ctx context.Context) (*ContextValue, bool)
ContextFetchValue returns the User value stored in ctx, if any.
Click to show internal directories.
Click to hide internal directories.