Documentation ¶
Overview ¶
Provides leaky buffer, based on the example in Effective Go.
Index ¶
- Constants
- Variables
- func AfterSeconds(secs int) time.Time
- func BPutUint16(b []byte, v uint16)
- func BPutUint32(b []byte, v uint32)
- func BPutUint64(b []byte, v uint64)
- func BUint16(b []byte) uint16
- func BUint32(b []byte) uint32
- func BUint64(b []byte) uint64
- func BytesToInt32(b []byte) int
- func CopyMap(dest, src map[string]interface{})
- func CutMsgWithTemplate(tpl interface{}, msg interface{}) interface{}
- func FileExists(path string) bool
- func GetRandomBytes(n int, alphabets ...byte) []byte
- func GetRandomString(n int, alphabets ...byte) string
- func Int32Distinct(intList []int32) []int32
- func Int32ListEqual(a []int32, b []int32) bool
- func Int32ListRemove(intList []int32, element int) []int32
- func Int64ToString(num int64) string
- func IntTo4Bytes(n int) []byte
- func IntToString(num int) string
- func IsDir(path string) bool
- func IsFile(path string) bool
- func IsStringInArray(str string, array []string) bool
- func IsStringWildCardMatchArray(s string, array []string) bool
- func LPutUint16(b []byte, v uint16)
- func LPutUint32(b []byte, v uint32)
- func LPutUint64(b []byte, v uint64)
- func LUint16(b []byte) uint16
- func LUint32(b []byte) uint32
- func LUint64(b []byte) uint64
- func MakeTimeFromMicroSeconds(usec int64) time.Time
- func MakeTimeFromMilliSeconds(msec int64) time.Time
- func MakeTimeFromNanoSeconds(nsec int64) time.Time
- func MakeTimeFromSeconds(sec int64) time.Time
- func Max(a, b int) int
- func Min(a, b int) int
- func NewRandString(alphabets string, length int) string
- func ObjectToJSONBuffer(obj interface{}) (res []byte)
- func PackUint32BE(num uint32) []byte
- func PackUint32LE(num uint32) []byte
- func PathExists(path string) (bool, error)
- func SelfDir() string
- func SelfPath() string
- func StringToFloat32(str string) float32
- func StringToFloat64(str string) float64
- func StringToInt(str string) int
- func StringToInt64(str string) int64
- func StringToUint32(str string) uint32
- func StringToUint64(str string) uint64
- func TimeNowMicroSecond() int64
- func TimeNowMilliSecond() int64
- func TimeNowNonoSecond() int64
- func TimeNowSecond() int64
- func ToInt(value interface{}) (num int, err error)
- func ToInt64(value interface{}) (num int64, err error)
- func Uint64ToString(num uint64) string
- func UnpackUint32BE(data []byte) uint32
- func UnpackUint32LE(data []byte) uint32
- func WildCardDeepMatchRune(pattern, name []rune, plus bool) bool
- func WildCardMatch(pattern string, name string) bool
- type LeakyBuf
Constants ¶
const ( NanoPerMicro = 1000 NanoPerMilli = 1000 * NanoPerMicro NanoPerSecond = 1000 * NanoPerMilli NanoPerMinute = 60 * NanoPerSecond NanoPerHour = 60 * NanoPerMinute NanoPerDay = 24 * NanoPerHour NanoPerWeek = 7 * NanoPerDay MicroPerMilli = 1000 MicroPerSecond = 1000 * MicroPerMilli MicroPerMinute = 60 * MicroPerSecond MicroPerHour = 60 * MicroPerMinute MicroPerDay = 24 * MicroPerHour MicroPerWeek = 7 * MicroPerDay MilliPerSecond = 1000 MilliPerMinute = 60 * MilliPerSecond MilliPerHour = 60 * MilliPerMinute MilliPerDay = 24 * MilliPerHour MilliPerWeek = 7 * MilliPerDay SecondsPerMinute = 60 SecondsPerHour = 60 * SecondsPerMinute SecondsPerDay = 24 * SecondsPerHour SecondsPerWeek = 7 * SecondsPerDay )
Variables ¶
var GLeakyBuf = NewLeakyBuf(maxNBuf, leakyBufSize)
Functions ¶
func AfterSeconds ¶
AfterSeconds return secs seconds from now.
func BPutUint16 ¶
func BPutUint32 ¶
func BPutUint64 ¶
func CutMsgWithTemplate ¶
func CutMsgWithTemplate(tpl interface{}, msg interface{}) interface{}
CutMsgWithTemplate 根据 tpl 从 msg 中取出数据,放到 result 中
func FileExists ¶
FileExists judge whether file or directory exists.
func GetRandomBytes ¶
GetRandomBytes generate random byte slice @param n[in]: the length of random string
func GetRandomString ¶
GetRandomString generate random string @param n[in]: the length of random string
func Int32Distinct ¶
Int32Distinct get distinct elements from intList
func Int32ListEqual ¶
Int32ListEqual judge list a is equal to list b.
func Int32ListRemove ¶
Int32ListRemove remove element in intList
func IsStringInArray ¶
IsStringInArray is str in array
func IsStringWildCardMatchArray ¶
IsStringWildCardMatchArray 在数组 array 中查找字符串 s,用通配符匹配。
func LPutUint16 ¶
func LPutUint32 ¶
func LPutUint64 ¶
func MakeTimeFromMicroSeconds ¶
MakeTimeFromMicroSeconds construct one time.Time from micro second
func MakeTimeFromMilliSeconds ¶
MakeTimeFromMilliSeconds construct one time.Time from milli second
func MakeTimeFromNanoSeconds ¶
MakeTimeFromNanoSeconds construct one time.Time from nano second
func MakeTimeFromSeconds ¶
MakeTimeFromSeconds construct one time.Time from second
func NewRandString ¶
NewRandString generate random string
func ObjectToJSONBuffer ¶
func ObjectToJSONBuffer(obj interface{}) (res []byte)
ObjectToJSONBuffer json marshal
func PackUint32BE ¶
PackUint32BE pack uint32 to []byte, in big endian.
func PackUint32LE ¶
PackUint32LE pack uint32 to []byte, in little endian.
func PathExists ¶
PathExists judge whether file or directory exists. return:
true, nil : exist. false, nil: not exist. false, err: I don't know.
func StringToFloat32 ¶
StringToFloat32 convert string to float32
func StringToFloat64 ¶
StringToFloat64 convert string to float64
func StringToUint32 ¶
StringToUint32 convert string to uint32
func StringToUint64 ¶
StringToUint64 convert string to uint64
func Uint64ToString ¶
Uint64ToString convert uint64 to string
func UnpackUint32BE ¶
UnpackUint32BE unpack []byte to uint32, in big endian.
func UnpackUint32LE ¶
UnpackUint32LE unpack []byte to uint32, in little endian.
func WildCardDeepMatchRune ¶
func WildCardMatch ¶
WildCardMatch 通配符匹配字符串 ?: 匹配 0 个或者 1 个字符 *: 匹配 0 个,1 个或者任意多个字符 +: 匹配 1 个字符或者任意个字符,也就是至少 1 个字符
WildCardMatch("a?c", "abc") == true WildCardMatch("a?c", "ac") == true
WildCardMatch("a*c", "ac") == true WildCardMatch("a*c", "abc") == true WildCardMatch("a*c", "abbbc") == true
WildCardMatch("a+c", "ac") == false WildCardMatch("a+c", "abc") == true WildCardMatch("a+c", "abbbc") == true
Types ¶
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Package cache provide a Cache interface and some implement engine Usage: import( "github.com/astaxie/beego/cache" ) bm, err := cache.NewCache("memory", `{"interval":60}`) Use it like this: bm.Put("astaxie", 1, 10 * time.Second) bm.Get("astaxie") bm.IsExist("astaxie") bm.Delete("astaxie") more docs http://beego.me/docs/module/cache.md
|
Package cache provide a Cache interface and some implement engine Usage: import( "github.com/astaxie/beego/cache" ) bm, err := cache.NewCache("memory", `{"interval":60}`) Use it like this: bm.Put("astaxie", 1, 10 * time.Second) bm.Get("astaxie") bm.IsExist("astaxie") bm.Delete("astaxie") more docs http://beego.me/docs/module/cache.md |
commander
|
|
container
|
|
Package log implements a simple logging package.
|
Package log implements a simple logging package. |
logrus
|
|