utils

package
v0.0.33 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetContextLogger

func GetContextLogger(ctx context.Context) *zap.Logger

func GetContextSpan

func GetContextSpan(ctx context.Context) oteltrace.Span

func IsProducerNameExistsError

func IsProducerNameExistsError(name string, err error) bool

func NewContextWithValues

func NewContextWithValues(ctx context.Context, workerName string) context.Context

func SetContextConsumer

func SetContextConsumer(ctx context.Context, consumer pulsar.Consumer)

func SetContextProducer

func SetContextProducer(ctx context.Context, publisher pulsar.Producer)

Types

type ContextKey

type ContextKey string
const (
	Values      ContextKey = "notification-values"
	Producer    ContextKey = "producer"
	Consumer    ContextKey = "consumer"
	Logger      ContextKey = "logger"
	WorkerName  ContextKey = "worker-name"
	CurrentSpan ContextKey = "current-span"
)

type ContextValues

type ContextValues struct {
	*sync.Map
}

func GetContextValues

func GetContextValues(ctx context.Context) *ContextValues

func (*ContextValues) Get

func (c *ContextValues) Get(key string) string

func (*ContextValues) GetAndDeleteCurrentSpan

func (c *ContextValues) GetAndDeleteCurrentSpan() oteltrace.Span

func (*ContextValues) GetConsumer

func (c *ContextValues) GetConsumer() pulsar.Consumer

func (*ContextValues) GetCurrentSpan

func (c *ContextValues) GetCurrentSpan() oteltrace.Span

func (*ContextValues) GetLogger

func (c *ContextValues) GetLogger() *zap.Logger

func (*ContextValues) GetProducer

func (c *ContextValues) GetProducer() pulsar.Producer

func (*ContextValues) GetWorkerName

func (c *ContextValues) GetWorkerName() string

func (*ContextValues) Keys

func (c *ContextValues) Keys() []string

func (*ContextValues) Set

func (c *ContextValues) Set(key string, value string)

Jump to

Keyboard shortcuts

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