Documentation ¶
Index ¶
- Constants
- func AddContextxMiddleware() gin.HandlerFunc
- type Contextx
- func Background() Contextx
- func FromGin(c *gin.Context) (Contextx, error)
- func WithCancel(parent Contextx) (Contextx, context.CancelFunc)
- func WithLogger(logger *zap.Logger) Contextx
- func WithTimeout(parent Contextx, d time.Duration) (Contextx, context.CancelFunc)
- func WithValue(parent Contextx, key, val interface{}) Contextx
Constants ¶
View Source
const KeyCtx = "contextx"
KeyCtx is the key of contextx.
Variables ¶
This section is empty.
Functions ¶
func AddContextxMiddleware ¶
func AddContextxMiddleware() gin.HandlerFunc
AddContextxMiddleware is used to add contextx middleware.
Types ¶
type Contextx ¶
Contextx extends google's context to support logging methods.
func Background ¶
func Background() Contextx
Background returns a non-nil, empty Contextx. It is never canceled, has no values, and has no deadline.
func WithCancel ¶
func WithCancel(parent Contextx) (Contextx, context.CancelFunc)
WithCancel returns a copy of the parent context with a new Done channel.
func WithLogger ¶
WithLogger returns a copy of parent in which the value associated with key is val.
func WithTimeout ¶
WithTimeout returns a copy of the parent context with the timeout adjusted to be no later than d.
Click to show internal directories.
Click to hide internal directories.