Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CTX ¶
type CTX struct { context.Context logrus.FieldLogger }
CTX extends the standard context from the standard library, integrating it with the logrus package for structured logging. It allows passing around a single object in function calls that provides both context management (like cancellation and timeouts) and the ability to log structured data.
func Background ¶
func Background() CTX
Background returns a non-nil, empty Context. It is typically used for initialization and in situations where there is no existing context (like in the main function or tests).
func WithCancel ¶
func WithCancel(parent CTX) (CTX, context.CancelFunc)
WithCancel creates a new CTX and a cancel function from the provided parent CTX. The cancel function, when called, cancels the new CTX, releasing any resources associated with it, such as child goroutines waiting on the CTX's Done channel.
func WithValue ¶
WithValue returns a copy of the parent for adding metadata to the context and logs, which can then be passed down through function calls.
func WithValues ¶
WithValues is similar to WithValue, but allows adding multiple key-value pairs at once.