util

package
v1.53.0 Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2026 License: Apache-2.0 Imports: 14 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Drf

func Drf[T any](p *T) T

takes abitary pointer and returns value of the pointer

func FirstListenThenServe

func FirstListenThenServe(srv *http.Server, log *logrus.Logger)

FirstListenThenServe is a utility function that ensures that first a listener is spin up then the http server is setup for serving asynchronously this is requried to ensure in tests that the server is spinned up before jumping to tests.

func GenerateRandomString

func GenerateRandomString(length int, cs *string) string

func GetProjectRoot

func GetProjectRoot() (string, error)

func GetRandomFreePort

func GetRandomFreePort() string

func IsPortFree

func IsPortFree(port string) bool

func NewRateLimitedHTTPClient added in v1.52.0

func NewRateLimitedHTTPClient(limit rate.Limit, burst int, base http.RoundTripper) *http.Client

func Ptr

func Ptr[T any](v T) *T

takes abitary value and returns a pointer to the value

func RequestWithBackoff

func RequestWithBackoff(requestFunction func() error) error

func SetEnvVars

func SetEnvVars(f string) error

Types

type RateLimitedRoundTripper added in v1.52.0

type RateLimitedRoundTripper struct {
	Base    http.RoundTripper
	Limiter *rate.Limiter
}

func (*RateLimitedRoundTripper) RoundTrip added in v1.52.0

func (r *RateLimitedRoundTripper) RoundTrip(req *http.Request) (*http.Response, error)

Jump to

Keyboard shortcuts

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