util

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: May 2, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ApplyContext

func ApplyContext(f func(ctx context.Context) error, ctx context.Context) func() error

func ContextWithHTTPSO

func ContextWithHTTPSO(ctx context.Context, httpso *httpv1alpha1.HTTPScaledObject) context.Context

func ContextWithLogger

func ContextWithLogger(ctx context.Context, logger logr.Logger) context.Context

func ContextWithStream

func ContextWithStream(ctx context.Context, url *url.URL) context.Context

func DeapplyError

func DeapplyError(f func(), err error) func() error

func HTTPSOFromContext

func HTTPSOFromContext(ctx context.Context) *httpv1alpha1.HTTPScaledObject

func IgnoringError

func IgnoringError(f func() error)

func IsIgnoredErr added in v0.6.0

func IsIgnoredErr(err error) bool

func IsNil

func IsNil(i interface{}) bool

func LoggerFromContext

func LoggerFromContext(ctx context.Context) logr.Logger

func RequestWithHTTPSO

func RequestWithHTTPSO(r *http.Request, httpso *httpv1alpha1.HTTPScaledObject) *http.Request

func RequestWithLogger

func RequestWithLogger(r *http.Request, logger logr.Logger) *http.Request

func RequestWithLoggerWithName

func RequestWithLoggerWithName(r *http.Request, name string) *http.Request

func RequestWithStream

func RequestWithStream(r *http.Request, stream *url.URL) *http.Request

func ResolveOsEnvBool added in v0.6.0

func ResolveOsEnvBool(envName string, defaultValue bool) (bool, error)

func ResolveOsEnvDuration added in v0.6.0

func ResolveOsEnvDuration(envName string) (*time.Duration, error)

func ResolveOsEnvInt added in v0.6.0

func ResolveOsEnvInt(envName string, defaultValue int) (int, error)

func StreamFromContext

func StreamFromContext(ctx context.Context) *url.URL

func WithTimeout

func WithTimeout(d time.Duration, f func() error) error

Types

type AtomicValue

type AtomicValue[V any] struct {
	// contains filtered or unexported fields
}

func NewAtomicValue

func NewAtomicValue[V any](v V) *AtomicValue[V]

func (*AtomicValue[V]) Get

func (av *AtomicValue[V]) Get() V

func (*AtomicValue[V]) Set

func (av *AtomicValue[V]) Set(v V)

type HealthChecker

type HealthChecker interface {
	HealthCheck(ctx context.Context) error
}

type HealthCheckerFunc

type HealthCheckerFunc func(ctx context.Context) error

func (HealthCheckerFunc) HealthCheck

func (f HealthCheckerFunc) HealthCheck(ctx context.Context) error

type Signaler

type Signaler interface {
	Signal()
	Wait(ctx context.Context) error
}

func NewSignaler

func NewSignaler() Signaler

type Stopwatch

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

func (*Stopwatch) ElapsedTime

func (sw *Stopwatch) ElapsedTime() time.Duration

func (*Stopwatch) Start

func (sw *Stopwatch) Start()

func (*Stopwatch) StartTime

func (sw *Stopwatch) StartTime() time.Time

func (*Stopwatch) Stop

func (sw *Stopwatch) Stop()

func (*Stopwatch) StopTime

func (sw *Stopwatch) StopTime() time.Time

Jump to

Keyboard shortcuts

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