ctxutil

package
v0.3.0-nightly.20220913 Latest Latest
Warning

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

Go to latest
Published: Sep 9, 2022 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ContextWithMessageID

func ContextWithMessageID(ctx context.Context, messageID string) context.Context

ContextWithMessageID wraps ctx and returns a context that contains message ID.

func ContextWithRequestID

func ContextWithRequestID(ctx context.Context, requestID string) context.Context

ContextWithRequestID wraps ctx and returns a context that contains requestID.

func ContextWithTransaction

func ContextWithTransaction(ctx context.Context, transaction database.Transaction) context.Context

ContextWithTransaction wraps ctx and returns a context that contains transaction.

func MessageIDFromContext

func MessageIDFromContext(ctx context.Context) string

MessageIDFromContext fetches the record message ID from the context. If the context does not contain a message ID it returns nil.

func RequestIDFromContext

func RequestIDFromContext(ctx context.Context) string

RequestIDFromContext fetches the request ID from the context. If the context does not contain a request ID it returns nil.

func TransactionFromContext

func TransactionFromContext(ctx context.Context) database.Transaction

TransactionFromContext fetches the transaction from the context. If the context does not contain a transaction it returns nil.

Types

type MessageIDLogCtxHook

type MessageIDLogCtxHook struct{}

MessageIDLogCtxHook fetches the record message ID from the context and if it exists it adds the messageID to the log output.

func (MessageIDLogCtxHook) Run

Run executes the log hook.

type RequestIDLogCtxHook

type RequestIDLogCtxHook struct{}

RequestIDLogCtxHook fetches the request ID from the context and if it exists it adds the request ID to the log output.

func (RequestIDLogCtxHook) Run

Run executes the log hook.

Jump to

Keyboard shortcuts

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