Documentation ¶
Index ¶
- Constants
- func ByteSize(bytes uint64) string
- func ConvertToBytes(humanReadableString string) int
- func CopyBytes(b []byte) []byte
- func CopyString(s string) string
- func EqualFold[S byteSeq](b, s S) bool
- func FunctionName(fn any) string
- func GetArgument(arg string) bool
- func GetMIME(extension string) string
- func IncrementIPRange(ip net.IP)
- func IsIPv4(s string) bool
- func IsIPv6(s string) bool
- func ParseVendorSpecificContentType(cType string) string
- func ReadFile(path string, fs http.FileSystem) ([]byte, error)
- func StartTimeStampUpdater()
- func StatusMessage(status int) string
- func Timestamp() uint32
- func ToLower(b string) string
- func ToLowerBytes(b []byte) []byte
- func ToString(arg any, timeFormat ...string) string
- func ToUpper(b string) string
- func ToUpperBytes(b []byte) []byte
- func UUID() string
- func UUIDv4() string
- func UnsafeBytes(s string) []byte
- func UnsafeString(b []byte) string
- func Walk(fs http.FileSystem, root string, walkFn filepath.WalkFunc) error
- type JSONMarshal
- type JSONUnmarshal
- type XMLMarshal
- type XMLUnmarshal
Constants ¶
const MIMEOctetStream = "application/octet-stream"
Variables ¶
This section is empty.
Functions ¶
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 ¶
ConvertToBytes returns integer size of bytes from human-readable string, ex. 42kb, 42M Returns 0 if string is unrecognized
func EqualFold ¶
func EqualFold[S byteSeq](b, s S) bool
EqualFold tests ascii strings or bytes for equality case-insensitively
func IncrementIPRange ¶
IncrementIPRange Find available next IP address
func IsIPv4 ¶
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 ¶
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 ReadFile ¶
func ReadFile(path string, fs http.FileSystem) ([]byte, error)
ReadFile returns the raw content of a file
func StartTimeStampUpdater ¶
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 Timestamp ¶
func Timestamp() uint32
Timestamp returns the current time. Make sure to start the updater once using StartTimeStampUpdater() before calling.
func ToLowerBytes ¶
ToLowerBytes converts ascii slice to lower-case
func ToUpperBytes ¶
ToUpperBytes converts ascii slice to upper-case
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 ¶
XMLMarshal returns the XML encoding of v.
type XMLUnmarshal ¶
XMLUnmarshal parses the XML-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.