Documentation ¶
Index ¶
- Constants
- Variables
- func Chk(err error)
- func HmacSha256(s string, key string) string
- func HttpGet(getUrl string, credential ...string) ([]byte, error)
- func HttpGet2(getUrl string, contentType string, opt *HttpOpt) ([]byte, error)
- func HttpPost(postUrl string, q url.Values, credential ...string) ([]byte, error)
- func HttpPost2(postUrl string, contentType string, body io.Reader, opt *HttpOpt) ([]byte, error)
- func IntToInf(src []int) []interface{}
- func IsPemExpire(b []byte) (bool, error)
- func Md5(b []byte) []byte
- func Md5Str(salt string) func(string) string
- func MultiDeleteFromMap(m map[string]interface{}, ks ...string)
- func ParseAddr(s string) (string, int, error)
- func SendMail(user, password, host, to, subject, body, mailtype string) error
- func SetHttpClient(hc *http.Client)
- func Sha1Str(salt string) func(string) string
- func Sha256Str(salt string) func(string) string
- func Shuffle(src []string) []string
- func SplitIntSlice(src []int, chunkSize int) [][]int
- func SplitStringSlice(src []string, chunkSize int) [][]string
- func SplitStringSliceIntoN(a []string, n int) [][]string
- func StrToInf(src []string) []interface{}
- func Truncate(s string, n int) string
- func Unique(data []interface{}) []interface{}
- func UniqueInt(data []int) []int
- func UniqueStr(data []string) []string
- type BasicAuth
- type HttpOpt
- type J
- type MemQueue
- type PerfLog
- type SyncMap
- type Throttle
- type Tick
- type TimerCache
Constants ¶
View Source
const ( MAX_HTTP_CLIENT_CONCURRENT = 1000 ContentTypeForm = "application/x-www-form-urlencoded" ContentTypeJson = "application/json; charset=utf-8" )
Variables ¶
View Source
var ( // PlainMd5 string md5 function with empty salt PlainMd5 = Md5Str("") // PlainMd5 string sha-1 function with empty salt PlainSha1 = Sha1Str("") )
View Source
var (
ErrEmptyHeaderName = errors.New("header name must not be empty")
)
View Source
var ErrFull = errors.New("queue is full")
Functions ¶
func HmacSha256 ¶
func IsPemExpire ¶
func MultiDeleteFromMap ¶ added in v1.2.2
func SetHttpClient ¶ added in v1.2.7
HTTP Client expose for further customize
func SplitIntSlice ¶ added in v1.2.8
SplitIntSlice split int slice into chunks
func SplitStringSlice ¶ added in v1.2.8
SplitStringSlice split string slice into chunks
func SplitStringSliceIntoN ¶ added in v1.2.8
SplitStringSliceIntoN split a into several parts, no more than n
Types ¶
type MemQueue ¶
type MemQueue chan interface{}
MemQueue memory queue
func NewLeakMemQueue ¶
NewLeakMemQueue create memory queue, auto-leak element concurrently to worker
func (MemQueue) EnqBlocking ¶
func (p MemQueue) EnqBlocking(data interface{})
EnqBlocking enqueue, block if queue is full
type Throttle ¶
type Throttle struct {
// contains filtered or unexported fields
}
func NewThrottle ¶
type Tick ¶
type Tick int64
Tick unix timestamp in millisecond
type TimerCache ¶
type TimerCache struct {
// contains filtered or unexported fields
}
func NewTimerCache ¶
func NewTimerCache(ttl int, expireCb func(key, value interface{})) *TimerCache
ttl in second expireCb, expire callback
func (*TimerCache) Get ¶
func (p *TimerCache) Get(key interface{}) interface{}
func (*TimerCache) Keys ¶
func (p *TimerCache) Keys() []interface{}
func (*TimerCache) Len ¶
func (p *TimerCache) Len() int
func (*TimerCache) Put ¶
func (p *TimerCache) Put(key, val interface{}) bool
func (*TimerCache) Remove ¶
func (p *TimerCache) Remove(key interface{}) interface{}
func (*TimerCache) TTL ¶ added in v1.2.6
func (p *TimerCache) TTL(key interface{}) int64
TTL Check ttl (in second)
Click to show internal directories.
Click to hide internal directories.