Documentation
¶
Index ¶
- Constants
- func AssertEqual(t testing.TB, expected interface{}, actual interface{}, description ...string)
- func ByteSize(bytes uint64) string
- func DefaultBytes(value []byte, defaultValue []byte) []byte
- func DefaultINT(value int, defaultValue int) int
- func DefaultString(value string, defaultValue string) string
- func EqualsFold(b, s []byte) (equals bool)
- func FunctionName(fn interface{}) string
- func GetArgument(arg string) bool
- func GetBytes(s string) []byte
- func GetMIME(extension string) (mime string)
- func GetString(b []byte) string
- func IfToLower(s string) string
- func IfToUpper(s string) string
- func ImmutableString(s string) string
- func ReadFile(path string, fs http.FileSystem) ([]byte, error)
- func SafeBytes(b []byte) []byte
- func SafeString(s string) string
- func StatusMessage(status int) string
- func ToLower(b string) string
- func ToLowerBytes(b []byte) []byte
- 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 UnsafeBytes(s string) (bs []byte)
- func UnsafeString(b []byte) string
- func Walk(fs http.FileSystem, root string, walkFn filepath.WalkFunc) error
Constants ¶
const MIMEOctetStream = "application/octet-stream"
Variables ¶
This section is empty.
Functions ¶
func AssertEqual ¶
AssertEqual checks if values are equal
func ByteSize ¶ added in v0.0.7
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 DefaultBytes ¶ added in v0.1.1
DefaultBytes returns the provided fallback value if []byte is empty
func DefaultINT ¶ added in v0.1.2
DefaultINT returns the provided fallback value if int is 0 or lower
func DefaultString ¶ added in v0.1.1
DefaultString returns the provided fallback value if string is empty
func EqualsFold ¶
EqualFold the equivalent of bytes.EqualFold
func FunctionName ¶ added in v0.0.6
func FunctionName(fn interface{}) string
FunctionName returns function name
func IfToLower ¶ added in v1.2.0
IfToLower returns an lowercase version of the input ASCII string.
It first checks if the string contains any uppercase characters before converting it.
For strings that are already lowercase,this function will be faster than `ToLower`.
In the case of mixed-case or uppercase strings, this function will be slightly slower than `ToLower`.
func IfToUpper ¶ added in v1.2.0
IfToUpper returns an uppercase version of the input ASCII string.
It first checks if the string contains any lowercase characters before converting it.
For strings that are already uppercase,this function will be faster than `ToUpper`.
In the case of mixed-case or lowercase strings, this function will be slightly slower than `ToUpper`.
func ImmutableString ¶ added in v0.0.4
ImmutableString copies a string to make it immutable
func ReadFile ¶ added in v1.1.0
func ReadFile(path string, fs http.FileSystem) ([]byte, error)
#nosec G304 ReadFile returns the raw content of a file
func SafeString ¶ added in v0.1.0
SafeString copies a string to make it immutable
func StatusMessage ¶ added in v0.0.2
StatusMessage returns the correct message for the provided HTTP statuscode
func ToLowerBytes ¶
ToLowerBytes is the equivalent of bytes.ToLower
func ToUpperBytes ¶
ToUpperBytes is the equivalent of bytes.ToUpper
func TrimLeftBytes ¶ added in v0.0.10
TrimLeftBytes is the equivalent of bytes.TrimLeft
func TrimRightBytes ¶ added in v0.0.10
TrimRightBytes is the equivalent of bytes.TrimRight
func UUID ¶ added in v0.0.4
func UUID() string
UUID generates an universally unique identifier (UUID)
func UnsafeBytes ¶ added in v0.1.0
#nosec G103 GetBytes returns a byte pointer without allocation
func UnsafeString ¶ added in v0.1.0
#nosec G103 GetString returns a string pointer without allocation
Types ¶
This section is empty.