Documentation ¶
Index ¶
- Constants
- Variables
- func AssertEqual(tb testing.TB, expected, actual interface{}, description ...string)
- func ByteSize(bytes uint64) string
- func ConvertToBytes(humanReadableString string) int
- func CopyBytes(b []byte) []byte
- func CopyString(s string) string
- func EqualFold(b, s string) bool
- func EqualFoldBytes(b, s []byte) bool
- func FunctionName(fn interface{}) string
- func GetArgument(arg string) bool
- func GetBytes(s string) []bytedeprecated
- func GetMIME(extension string) string
- func GetString(b []byte) stringdeprecated
- func ImmutableString(s string) stringdeprecated
- func IncrementIPRange(ip net.IP)
- func IsIPv4(s string) bool
- func IsIPv6(s string) bool
- func ParseVendorSpecificContentType(cType string) string
- func StartTimeStampUpdater()
- func StatusMessage(status int) string
- func ToLower(b string) string
- func ToLowerBytes(b []byte) []byte
- func ToString(arg interface{}, timeFormat ...string) string
- func ToUpper(b string) string
- func ToUpperBytes(b []byte) []byte
- func Trim(s string, cutset byte) string
- func TrimBytes(b []byte, cutset byte) []byte
- func TrimLeft(s string, cutset byte) string
- func TrimLeftBytes(b []byte, cutset byte) []byte
- func TrimRight(s string, cutset byte) string
- func TrimRightBytes(b []byte, cutset byte) []byte
- func UUID() string
- func UUIDv4() string
- func UnsafeBytes(s string) []byte
- func UnsafeString(b []byte) string
- type JSONMarshal
- type JSONUnmarshal
- type XMLMarshal
Constants ¶
const MIMEOctetStream = "application/octet-stream"
Variables ¶
var ( // Timestamp please start the timer function before you use this value // please load the value with atomic `atomic.LoadUint32(&utils.Timestamp)` Timestamp uint32 )
Functions ¶
func AssertEqual ¶
AssertEqual checks if values are equal
func ByteSize ¶
ByteSize returns a human-readable byte string of the form 10M, 12.5K, and so forth. The unit that results in the smallest number greater than or equal to 1 is always chosen.
func ConvertToBytes ¶ added in v2.34.0
ConvertToBytes returns integer size of bytes from human-readable string, ex. 42kb, 42M Returns 0 if string is unrecognized
func EqualFoldBytes ¶
EqualFoldBytes tests ascii slices for equality case-insensitively
func ImmutableString
deprecated
func IncrementIPRange ¶ added in v2.21.0
IncrementIPRange Find available next IP address
func IsIPv4 ¶ added in v2.42.0
IsIPv4 works the same way as net.ParseIP, but without check for IPv6 case and without returning net.IP slice, whereby IsIPv4 makes no allocations.
func IsIPv6 ¶ added in v2.42.0
IsIPv6 works the same way as net.ParseIP, but without check for IPv4 case and without returning net.IP slice, whereby IsIPv6 makes no allocations.
func ParseVendorSpecificContentType ¶
ParseVendorSpecificContentType check if content type is vendor specific and if it is parsable to any known types. If its not vendor specific then returns the original content type.
func StartTimeStampUpdater ¶ added in v2.42.0
func StartTimeStampUpdater()
StartTimeStampUpdater starts a concurrent function which stores the timestamp to an atomic value per second, which is much better for performance than determining it at runtime each time
func StatusMessage ¶
StatusMessage returns the correct message for the provided HTTP statuscode
func ToLowerBytes ¶
ToLowerBytes converts ascii slice to lower-case in-place.
func ToUpperBytes ¶
ToUpperBytes converts ascii slice to upper-case in-place.
func TrimLeftBytes ¶
TrimLeftBytes is the equivalent of bytes.TrimLeft
func TrimRightBytes ¶
TrimRightBytes is the equivalent of bytes.TrimRight
func UUIDv4 ¶
func UUIDv4() string
UUIDv4 returns a Random (Version 4) UUID. The strength of the UUIDs is based on the strength of the crypto/rand package.
func UnsafeBytes ¶
UnsafeBytes returns a byte pointer without allocation.
func UnsafeString ¶
UnsafeString returns a string pointer without allocation
Types ¶
type JSONMarshal ¶
JSONMarshal returns the JSON encoding of v.
type JSONUnmarshal ¶
JSONUnmarshal parses the JSON-encoded data and stores the result in the value pointed to by v. If v is nil or not a pointer, Unmarshal returns an InvalidUnmarshalError.
type XMLMarshal ¶ added in v2.42.0
XMLMarshal returns the XML encoding of v.