Documentation ¶
Index ¶
- Constants
- func AbsPath(path string) string
- func Bytes(s uint64) string
- func CamelCase(str string) string
- func Combine(key string, val interface{}) map[string]interface{}
- func CopyDir(source string, dest string) (err error)
- func CopyFile(source string, dest string) (err error)
- func FileExists(path string) bool
- func HBytes(s uint64) string
- func IBytes(s uint64) string
- func IsPrivateIp(ip string) bool
- func ParseBytes(s string) (uint64, error)
- func RandAlphaString() string
- func RandAlphaStringN(n int) string
- func RandDatePrefixUint64() uint64
- func RandDigitString() string
- func RandDigitStringN(n int) string
- func RandString() string
- func RandStringN(n int) string
- func RandUint() uint
- func RandUint32() uint32
- func RandUint32In(low, hi uint32) uint32
- func RandUint64() uint64
- func RandUint64In(low, hi uint64) uint64
- func RandUintIn(low, hi uint) uint
- func SnakeCase(str string) string
- func Timestamp() uint32
- type Matcher
- func (m *Matcher) AddBlackItem(item string) *Matcher
- func (m *Matcher) AddWhiteItem(item string) *Matcher
- func (m *Matcher) DelBlackItem(item string) *Matcher
- func (m *Matcher) DelWhiteItem(item string) *Matcher
- func (m *Matcher) Match(target string) bool
- func (m *Matcher) SetBlackList(blackList []string) *Matcher
- func (m *Matcher) SetWhiteList(whiteList []string) *Matcher
Constants ¶
View Source
const ( Byte = 1 << (iota * 10) KiByte MiByte GiByte TiByte PiByte EiByte )
IEC Sizes. kibis of bits
View Source
const ( IByte = 1 KByte = IByte * 1000 MByte = KByte * 1000 GByte = MByte * 1000 TByte = GByte * 1000 PByte = TByte * 1000 EByte = PByte * 1000 )
SI Sizes.
Variables ¶
This section is empty.
Functions ¶
func Bytes ¶
Bytes produces a human readable representation of an SI size.
See also: ParseBytes.
Bytes(82854982) -> 83MB
func FileExists ¶
FileExists checks whether a file or directory exists.
func HBytes ¶
HBytes produces a short human readable representation of an IEC size.
See also: ParseBytes.
HBytes(82854982) -> 79M
func IBytes ¶
IBytes produces a human readable representation of an IEC size.
See also: ParseBytes.
IBytes(82854982) -> 79MiB
func IsPrivateIp ¶
func ParseBytes ¶
ParseBytes parses a string representation of bytes into the number of bytes it represents.
See Also: Bytes, IBytes.
ParseBytes("42MB") -> 42000000, nil ParseBytes("42mib") -> 44040192, nil
func RandAlphaString ¶
func RandAlphaString() string
func RandAlphaStringN ¶
func RandDatePrefixUint64 ¶
func RandDatePrefixUint64() uint64
func RandDigitString ¶
func RandDigitString() string
func RandDigitStringN ¶
func RandString ¶
func RandString() string
func RandStringN ¶
func RandUint32 ¶
func RandUint32() uint32
func RandUint32In ¶
func RandUint64 ¶
func RandUint64() uint64
func RandUint64In ¶
func RandUintIn ¶
Types ¶
type Matcher ¶
type Matcher struct {
// contains filtered or unexported fields
}
func NewMatcher ¶
func NewMatcher() *Matcher
func (*Matcher) AddBlackItem ¶
func (*Matcher) AddWhiteItem ¶
func (*Matcher) DelBlackItem ¶
func (*Matcher) DelWhiteItem ¶
func (*Matcher) SetBlackList ¶
func (*Matcher) SetWhiteList ¶
Click to show internal directories.
Click to hide internal directories.