xutil

package
v0.1.8 Latest Latest
Warning

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

Go to latest
Published: Feb 2, 2021 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const MIMEOctetStream = "application/octet-stream"

Variables

This section is empty.

Functions

func ByteSize

func ByteSize(bytes uint64) string

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 CallerStack

func CallerStack(cd int, fns ...func(fn *runtime.Func, pc uintptr) string) string

CallerStack 调用栈

func CopyBytes

func CopyBytes(b []byte) []byte

CopyBytes copies a slice to make it immutable

func CopyString

func CopyString(s string) string

CopyString copies a string to make it immutable

func EqualFold

func EqualFold(b, s string) (equals bool)

EqualFold the equivalent of strings.EqualFold

func EqualFoldBytes

func EqualFoldBytes(b, s []byte) (equals bool)

EqualFold the equivalent of bytes.EqualFold

func Func

func Func(fn interface{}) func(...interface{}) func(...interface{})

func FuncRaw

func FuncRaw(fn interface{}) func(...interface{}) []reflect.Value

func FuncStack

func FuncStack(fn interface{}, fns ...func(fn *runtime.Func, pc uintptr) string) string

FuncStack 函数栈

func FuncValue

func FuncValue(fn interface{}) func(...reflect.Value) []reflect.Value

func GetMIME

func GetMIME(extension string) (mime string)

GetMIME returns the content-type of a file extension

func StatusMessage

func StatusMessage(status int) string

StatusMessage returns the correct message for the provided HTTP statuscode

func ToLower

func ToLower(b string) string

ToLower is the equivalent of strings.ToLower

func ToLowerBytes

func ToLowerBytes(b []byte) []byte

ToLowerBytes is the equivalent of bytes.ToLower

func ToUpper

func ToUpper(b string) string

ToUpper is the equivalent of strings.ToUpper

func ToUpperBytes

func ToUpperBytes(b []byte) []byte

ToUpperBytes is the equivalent of bytes.ToUpper

func Trim

func Trim(s string, cutset byte) string

Trim is the equivalent of strings.Trim

func TrimBytes

func TrimBytes(b []byte, c byte) []byte

TrimBytes is the equivalent of bytes.Trim

func TrimLeft

func TrimLeft(s string, cutset byte) string

TrimLeft is the equivalent of strings.TrimLeft

func TrimLeftBytes

func TrimLeftBytes(b []byte, c byte) []byte

TrimLeftBytes is the equivalent of bytes.TrimLeft

func TrimRight

func TrimRight(s string, cutset byte) string

TrimRight is the equivalent of strings.TrimRight

func TrimRightBytes

func TrimRightBytes(b []byte, c byte) []byte

TrimRightBytes is the equivalent of bytes.TrimRight

func UnsafeBytes

func UnsafeBytes(s string) (bs []byte)

#nosec G103 GetBytes returns a byte pointer without allocation

func UnsafeString

func UnsafeString(b []byte) string

#nosec G103 GetString returns a string pointer without allocation

Types

This section is empty.

Jump to

Keyboard shortcuts

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