utils

package
v1.0.6 Latest Latest
Warning

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

Go to latest
Published: Feb 8, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FormatMessage

func FormatMessage(msg, format string, counter int) string

FormatMessage formats the message according to the format string

func NewThrottledTransport added in v1.0.1

func NewThrottledTransport(limitPeriod time.Duration, requestCount int, transport http.RoundTripper) http.RoundTripper

NewThrottledTransport wraps transport with a rate limitter

func SelectFormat

func SelectFormat(cliFormat, configFormat string) string

SelectFormat returns the format string in the following order of precedence: 1. cliFormat 2. configFormat 3. defaultFormat

Types

type ThrottledTransport added in v1.0.1

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

ThrottledTransport is Rate Limited HTTP Client

func (*ThrottledTransport) RoundTrip added in v1.0.1

func (c *ThrottledTransport) RoundTrip(r *http.Request) (*http.Response, error)

RoundTrip implements the http.RoundTripper interface

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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