Documentation ¶
Index ¶
- Variables
- func Any(value interface{}) string
- func ByteToBase10(b []byte) (n uint64, err error)
- func Bytes2String(b []byte) (s string)
- func DecimalPrecision(f float64) float64
- func FileExists(fpath string) (bool, error)
- func Float64Bits(f float64, d int)
- func FormatAtom(v reflect.Value) string
- func GenCqlInString(ss []string) string
- func GenSqlInString(ss []string) string
- func GetGID() uint64
- func GetStack(all bool) string
- func HardwareAddr() (string, error)
- func HashS2UI32(s string) uint32
- func HashS2UI64(s string) uint64
- func Hostname() (string, error)
- func Interface2Int(v interface{}) int
- func Interface2String(v interface{}) (string, error)
- func IsCellphone(str ...string) bool
- func IsDecimals(str ...string) bool
- func IsEOF(err error) bool
- func IsEmail(s string) (bool, error)
- func IsEngishLowCase(str ...string) bool
- func IsEnglish(str ...string) bool
- func IsEnglishCap(str ...string) bool
- func IsID(str ...string) bool
- func IsIP(s string) bool
- func IsInteger(str ...string) bool
- func IsPwd(str ...string) bool
- func IsTelephone(str ...string) bool
- func IsURL(s string) bool
- func LocalIP() string
- func MSToTime(ms int64) (time.Time, error)
- func MiniteTimestamp(offset int64) int64
- func MurMurHash(data []byte) uint32
- func NSToTime(ns int64) (time.Time, error)
- func OnlyAlpha(s string) bool
- func OnlyAlphaAndMinus(s string) bool
- func OnlyAlphaAndNum(s string) bool
- func OnlyAlphaNumAndDot(s string) bool
- func OnlyAlphaNumAndUri(s string) bool
- func PrintStack(all bool)
- func PrivateIPv4() (net.IP, error)
- func RandString() string
- func ReadFull(conn net.Conn, b []byte, t int) (int, error)
- func RuntimeStats(gc bool, heapObj bool, goroutineNum bool) []int64
- func SplitString(str string) []string
- func String2Bytes(s string) (b []byte)
- func StringToTime(s string) (time.Time, error)
- func StringToTime1(s string) (time.Time, error)
- func StringToTime2(s string) (time.Time, error)
- func Time2String(t time.Time) string
- func Time2StringMinute(t time.Time) string
- func Time2StringSecond(t time.Time) string
- func Time2Version(t time.Time) string
- func TraceCode() func()
- func TransfarIP() string
- func TrimBytesExtraLineAndSpace(s []byte) []byte
- func TrimStringExtraLineAndSpace(s string) string
- func UnixMsToTimestring(n int64) string
- func UnixMsToTimestringMinute(n int64) string
- func UnixToTimestring(n int64) string
- func Walk(path string, followSymlinks bool, detectSymlinkInfiniteLoop bool, ...) error
- type BufferPool
- type WalkFunc
Constants ¶
This section is empty.
Variables ¶
var ErrWalkSkipDir = errors.New("skip this directory")
ErrWalkSkipDir is the Error returned when we want to skip descending into a directory
Functions ¶
func ByteToBase10 ¶
func Bytes2String ¶
func FileExists ¶
Exists determines whether a file/directory exists or not.
func FormatAtom ¶
func GenCqlInString ¶
func HardwareAddr ¶
func Interface2String ¶
将interface{}类型转为string类型
func IsEngishLowCase ¶
************************ 英文类型 ************************ 仅小写
func MurMurHash ¶
GetHash returns a murmur32 hash for the data slice.
func OnlyAlphaNumAndDot ¶
func OnlyAlphaNumAndUri ¶
func PrivateIPv4 ¶
func RuntimeStats ¶
获取常用runtime统计信息
func SplitString ¶
SplitString splits a string by commas or empty spaces.
func String2Bytes ¶
zero-coy, string类型转为[]byte 注意,这种做法下,一旦string变化,程序立马崩溃且不能recover 谨慎,黑科技!!除非性能瓶颈,否则请使用[]byte(s)
func StringToTime ¶
将"2016-02-15 12:00:00"或者"2016-04-18 09:33:56.694"等格式转化为time.Time
func StringToTime1 ¶
将"2016-04-22T21:47:49.694123232+08:00"或者"2016-04-22T21:47:49+08:00"等格式转化为time.Time
func Time2String ¶
func Time2StringMinute ¶
func Time2StringSecond ¶
func Time2Version ¶
func TransfarIP ¶
func TransfarIP() string
func TrimStringExtraLineAndSpace ¶
如果是连续的换行,则只保留一个换行 如果是tab,则替换为空格 如果是连续的空格,则只保留一个空格
func UnixMsToTimestring ¶
func UnixToTimestring ¶
func Walk ¶
Walk walks a path, optionally following symbolic links, and for each path, it calls the walkFn passed.
It is similar to filepath.Walk, except that it supports symbolic links and can detect infinite loops while following sym links. It solves the issue where your WalkFunc needs a path relative to the symbolic link (resolving links within walkfunc loses the path to the symbolic link for each traversal).
Types ¶
type BufferPool ¶
BufferPool represents a thread safe buffer pool
func NewBufferPool ¶
func NewBufferPool(bufferSize int) (bp *BufferPool)
NewBufferPool creates a new BufferPool bounded to the given size.
func (*BufferPool) Get ¶
func (bp *BufferPool) Get() *bytes.Buffer
Get gets a Buffer from the SizedBufferPool, or creates a new one if none are available in the pool. Buffers have a pre-allocated capacity.
func (*BufferPool) Put ¶
func (bp *BufferPool) Put(b *bytes.Buffer)
Put returns the given Buffer to the SizedBufferPool.