util

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2022 License: Apache-2.0 Imports: 18 Imported by: 11

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CompressGzip added in v1.3.3

func CompressGzip(body []byte) ([]byte, error)

func CopyMap added in v0.17.7

func CopyMap(originalMap map[string]string) map[string]string

func DecompressGzip added in v1.3.3

func DecompressGzip(body []byte) ([]byte, error)

func GetContentTypeFromHeaders added in v0.11.0

func GetContentTypeFromHeaders(headers map[string][]string) string

func GetMinifier added in v0.11.0

func GetMinifier() *minify.M

func GetRequestBody added in v0.10.0

func GetRequestBody(request *http.Request) (string, error)

GetRequestBody will read the http.Request body io.ReadCloser and will also set the buffer to the original value as the buffer will be empty after reading it. It also decompress if any Content-Encoding is applied

func GetResponseBody added in v0.10.0

func GetResponseBody(response *http.Response) (string, error)

GetResponseBody will read the http.Response body io.ReadCloser and will also set the buffer to the original value as the buffer will be empty after reading it.

func GetResponseHeaders added in v1.0.0

func GetResponseHeaders(response *http.Response) map[string][]string

func GetUnixTimeQueryParam added in v0.15.1

func GetUnixTimeQueryParam(request *http.Request, paramName string) *time.Time

func IsURL added in v1.3.2

func IsURL(str string) bool

func JSONMarshal added in v0.14.1

func JSONMarshal(t interface{}) ([]byte, error)

func MinifyJson added in v0.11.0

func MinifyJson(toMinify string) (string, error)

func MinifyXml added in v0.11.0

func MinifyXml(toMinify string) (string, error)

func NewLogFileHook added in v1.2.0

func NewLogFileHook(config LogFileConfig) (logrus.Hook, error)

func PointerToString

func PointerToString(value *string) string

func RandomBoolean added in v0.17.1

func RandomBoolean() bool

func RandomFloat added in v0.17.1

func RandomFloat() float64

func RandomFloatRange added in v0.17.1

func RandomFloatRange(min, max float64) float64

func RandomInteger added in v0.17.1

func RandomInteger() int

func RandomIntegerRange added in v0.17.1

func RandomIntegerRange(min, max int) int

func RandomString added in v0.17.1

func RandomString() string

func RandomStringWithLength added in v0.17.1

func RandomStringWithLength(length int) string

func SortQueryString added in v0.10.1

func SortQueryString(query string) string

SortQueryString will sort a http query string alphanumerically by key and then by value.

func StringToPointer

func StringToPointer(value string) *string

Types

type LogFileConfig added in v1.2.0

type LogFileConfig struct {
	Filename  string
	Level     logrus.Level
	Formatter logrus.Formatter
}

type LogFileHook added in v1.2.0

type LogFileHook struct {
	Config LogFileConfig
	// contains filtered or unexported fields
}

func (*LogFileHook) Fire added in v1.2.0

func (hook *LogFileHook) Fire(entry *logrus.Entry) (err error)

func (*LogFileHook) Levels added in v1.2.0

func (hook *LogFileHook) Levels() []logrus.Level

Jump to

Keyboard shortcuts

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