gctx

package
v2.0.0-...-bbb9e3c Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2023 License: MIT Imports: 6 Imported by: 32

Documentation

Overview

Package gctx wraps context.Context and provides extra context features.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CtxId

func CtxId(ctx context.Context) string

CtxId retrieves and returns the context id from context.

func GetInitCtx

func GetInitCtx() context.Context

GetInitCtx returns the initialization context. Initialization context is used in `main` or `init` functions.

func New

func New() context.Context

New creates and returns a context which contains context id.

func SetInitCtx

func SetInitCtx(ctx context.Context)

SetInitCtx sets custom initialization context. Note that this function cannot be called in multiple goroutines.

func WithCtx

func WithCtx(ctx context.Context) context.Context

WithCtx creates and returns a context containing context id upon given parent context `ctx`.

Types

type Ctx

type Ctx = context.Context // Ctx is short name alias for context.Context.

type StrKey

type StrKey string // StrKey is a type for warps basic type string as context key.

Jump to

Keyboard shortcuts

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