Documentation
¶
Index ¶
- Constants
- Variables
- func AreSlicesIntersect[T comparable](slice1, slice2 []T) bool
- func CloneRequestBody(r *http.Request) (body string)
- func CloneResponseBody(r *http.Response) (body string)
- func CloserFunc(r io.Reader, close func() error) io.ReadCloser
- func DurationUntilNextInterval(now time.Time, interval time.Duration) time.Duration
- func EscapeChars(str string, chars map[rune]struct{}) string
- func FillEmptyIP(ipv4, ipv6 string) (string, string)
- func FuncName() string
- func GetFirst(str string) string
- func GetRequestIP(r *http.Request) (requestIP string)
- func GetSecond(str string) string
- func IsInSlice[T comparable](i T, slice []T) bool
- func JoinIPVersions(ipv4, ipv6 string) (ip string)
- func JoinParams(first, second string) string
- func JoinQuoted(lines []string, quote, separator string) string
- func JoinQuotedInt(lines []int, quote, separator string) string
- func Retry(f func() error, times int)
- func RetryOverTime(f func() error, timeout time.Duration, tick time.Duration) error
- func SQLReplaceArgs(query string, args ...any) string
- func SetCORS(w http.ResponseWriter)
- func SetContentTypeHeader(w http.ResponseWriter, contentType ContentType)
- func SetCorsHeader(w http.ResponseWriter)
- func SplitIPVersions(ip string) (ipv4, ipv6 string)
- func ToUnderscoreACII(s string) (underscored string)
- func UnGzipBody(bodyContent []byte) ([]byte, error)
- type Commission
- type ContentType
- type Diff
- type Diffs
- type Distribution
- type Percent
- type SQLStringValue
- type Set
Constants ¶
View Source
const ( ContentEncodingHeader = "Content-Encoding" ContentEncodingGZIP = "gzip" )
View Source
const ( DefaultIPv4 = "0.0.0.0" DefaultIPv6 = "0000:0000:0000:0000:0000:0000:0000:0000" )
Variables ¶
Functions ¶
func AreSlicesIntersect ¶
func AreSlicesIntersect[T comparable](slice1, slice2 []T) bool
func CloneRequestBody ¶
func CloneResponseBody ¶
func CloserFunc ¶
func CloserFunc(r io.Reader, close func() error) io.ReadCloser
func EscapeChars ¶
func FillEmptyIP ¶
func GetRequestIP ¶
func IsInSlice ¶
func IsInSlice[T comparable](i T, slice []T) bool
func JoinIPVersions ¶
func JoinParams ¶
func JoinQuoted ¶
func JoinQuotedInt ¶
func RetryOverTime ¶
func SQLReplaceArgs ¶
func SetCORS ¶
func SetCORS(w http.ResponseWriter)
func SetContentTypeHeader ¶
func SetContentTypeHeader(w http.ResponseWriter, contentType ContentType)
func SetCorsHeader ¶
func SetCorsHeader(w http.ResponseWriter)
func SplitIPVersions ¶
func ToUnderscoreACII ¶
func UnGzipBody ¶
Types ¶
type Commission ¶
type Commission Percent
func (Commission) AddTo ¶
func (e Commission) AddTo(value float64) float64
func (Commission) SubtractFrom ¶
func (e Commission) SubtractFrom(value float64) float64
type ContentType ¶
type ContentType string
const ( ContentTypeApplicationJSON ContentType = "application/json" ContentTypeTextHTML ContentType = "text/html" )
type Distribution ¶
type Distribution []float64
func (*Distribution) GetMax ¶
func (d *Distribution) GetMax() float64
func (*Distribution) GetMin ¶
func (d *Distribution) GetMin() float64
func (*Distribution) GetQuantileValue ¶
func (d *Distribution) GetQuantileValue(quantileNumber uint) float64
func (*Distribution) TrimMax ¶
func (d *Distribution) TrimMax(difference float64)
TrimMax sorts and trims max values if difference is too big, difference 0.25 means 25% between max values
type Percent ¶
type Percent float64
const (
OnePercent Percent = 0.01
)
func PercentFrom ¶
func (*Percent) MarshalJSON ¶
func (Percent) ScaleReversed ¶
ScaleReversed returns 100% imply that val is p%
func (*Percent) UnmarshalJSON ¶
type SQLStringValue ¶
type SQLStringValue string
func ToSQLStringValue ¶
func ToSQLStringValue(lines ...string) []SQLStringValue
type Set ¶
type Set[data comparable] map[data]struct{}
func NewSet ¶
func NewSet[dataType comparable]() Set[dataType]
Click to show internal directories.
Click to hide internal directories.