common

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Jan 30, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FieldTraceID       = "traceId"
	TraceIDKey         = TraceIDType("key")
	RemoteIPKey        = RemoteIPType("key")
	PerformanceSpanKey = PerformanceSpanType("key")
	HeaderWorkloadLink = "X-Cpln-Workload-Link"
	HeaderIdentityLink = "X-Cpln-Identity-Link"
	AuthnTypeBearer    = "Bearer"
)

Variables

This section is empty.

Functions

func BoolPtr

func BoolPtr(b bool) *bool

func BoolToString

func BoolToString(b bool) string

func ContextWithSpan

func ContextWithSpan(ctx context.Context, span *PerformanceSpan) context.Context

ContextWithSpan stores a PerformanceSpan in the context, or adds a child span to the existing span in the context if one exists Returns a new context with the span

func EnablePerformanceTracking

func EnablePerformanceTracking()

func ExecuteWithRetries

func ExecuteWithRetries(fn func() error, numRetries int, base float64, maximum float64) (int, error)

func ExecuteWithRetriesContext

func ExecuteWithRetriesContext(ctx context.Context, fn func(ctx context.Context) error, numRetries int, base float64, maximum float64) (int, error)

ExecuteWithRetriesContext is like ExecuteWithRetries but supports context cancellation. The fn receives context so it can also check for cancellation.

func Float32Ptr

func Float32Ptr(f float32) *float32

func Float64Ptr

func Float64Ptr(f float64) *float64

func Int32Ptr

func Int32Ptr(i int32) *int32

func Int64Ptr

func Int64Ptr(i int64) *int64

func IntPtr

func IntPtr(i int) *int

func NewUuid

func NewUuid() string

func SetOutputStream

func SetOutputStream(stream io.Writer)

func StrPtr

func StrPtr(s string) *string

func Try

func Try(f func() error) error

Types

type DataContextType

type DataContextType string

type Iterator

type Iterator[T any] interface {
	Next() bool
	Item() T
	Error() error
}

type PerformanceSpan

type PerformanceSpan struct {
	// contains filtered or unexported fields
}

func AddChildSpan

func AddChildSpan(ctx context.Context, name string) (context.Context, *PerformanceSpan)

AddChildSpan retrieves the parent span from context, adds a child span to it, starts the child span, and returns a new context with the child span If no parent span exists in context, creates a new root span

func NewPerformanceSpan

func NewPerformanceSpan(name string) *PerformanceSpan

func SpanFromContext

func SpanFromContext(ctx context.Context) *PerformanceSpan

SpanFromContext retrieves a PerformanceSpan from the context Returns nil if no span is found in the context

func (*PerformanceSpan) Add

func (p *PerformanceSpan) Add(childName string, start bool) *PerformanceSpan

func (*PerformanceSpan) AddChild

func (p *PerformanceSpan) AddChild(child *PerformanceSpan)

func (*PerformanceSpan) Duration

func (p *PerformanceSpan) Duration() time.Duration
func (p *PerformanceSpan) Link(other *PerformanceSpan)

Link is deprecated - use AddChild instead

func (*PerformanceSpan) Start

func (p *PerformanceSpan) Start() *PerformanceSpan

func (*PerformanceSpan) Stop

func (p *PerformanceSpan) Stop() *PerformanceSpan

func (*PerformanceSpan) Summarize

func (p *PerformanceSpan) Summarize() string

type PerformanceSpanType

type PerformanceSpanType string

type RemoteIPType

type RemoteIPType string

type Stack

type Stack[T any] struct {
	// contains filtered or unexported fields
}

func NewStack

func NewStack[T any]() Stack[T]

func (*Stack[T]) Length

func (s *Stack[T]) Length() int

func (*Stack[T]) Pop

func (s *Stack[T]) Pop() T

func (*Stack[T]) Push

func (s *Stack[T]) Push(item T)

type StartStopper

type StartStopper interface {
	Start()
	Stop()
}

type TraceIDType

type TraceIDType string

Jump to

Keyboard shortcuts

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