Documentation ¶
Overview ¶
Forked from github.com/StefanKopieczek/gossip by @StefanKopieczek
Forked from github.com/StefanKopieczek/gossip by @StefanKopieczek
Forked from github.com/StefanKopieczek/gossip by @StefanKopieczek
Index ¶
- Constants
- func Coalesce(arg1 interface{}, arg2 interface{}, args ...interface{}) interface{}
- func Convert(dstCharset Charset, srcCharset Charset, src string) (dst string, err error)
- func MergeErrs(chs ...<-chan error) <-chan error
- func Noop()
- func RandString(n int) string
- func ResolveSelfIP() (net.IP, error)
- func StrPtrEq(a *string, b *string) bool
- func ToUTF8(srcCharset Charset, src string) (dst string, err error)
- func UTF8To(dstCharset Charset, src string) (dst string, err error)
- func UTF8ToGB2312(s []byte) []byte
- func Uint16PtrEq(a *uint16, b *uint16) bool
- type Charset
- type ElasticChan
- type Semaphore
Constants ¶
const ( GBK Charset = "GBK" GB18030 = "GB18030" GB2312 = "GB2312" Big5 = "Big5" )
中文
const ( UTF_8 Charset = "UTF-8" UTF_16 = "UTF-16" UTF_16BE = "UTF-16BE" UTF_16LE = "UTF-16LE" )
Unicode
Variables ¶
This section is empty.
Functions ¶
func ResolveSelfIP ¶
func StrPtrEq ¶
Check two string pointers for equality as follows: - If neither pointer is nil, check equality of the underlying strings. - If either pointer is nil, return true if and only if they both are.
func UTF8ToGB2312 ¶
func Uint16PtrEq ¶
Check two uint16 pointers for equality as follows: - If neither pointer is nil, check equality of the underlying uint16s. - If either pointer is nil, return true if and only if they both are.
Types ¶
type ElasticChan ¶
type ElasticChan struct { In chan interface{} Out chan interface{} // contains filtered or unexported fields }
A dynamic channel that does not block on send, but has an unlimited buffer capacity. ElasticChan uses a dynamic slice to buffer signals received on the input channel until the output channel is ready to process them.
func (*ElasticChan) Init ¶
func (c *ElasticChan) Init()
Initialise the Elastic channel, and start the management goroutine.
func (*ElasticChan) Log ¶
func (c *ElasticChan) Log() log.Logger
func (*ElasticChan) Run ¶
func (c *ElasticChan) Run()
func (*ElasticChan) SetLog ¶
func (c *ElasticChan) SetLog(logger log.Logger)
func (*ElasticChan) Stop ¶
func (c *ElasticChan) Stop()
type Semaphore ¶
type Semaphore interface { // Take a semaphore lock. Acquire() // Release an acquired semaphore lock. // This should only be called when the semaphore is blocked, otherwise behaviour is undefined Release() // Block execution until the semaphore is free. Wait() // Clean up the semaphore object. Dispose() }
Simple semaphore implementation. Any number of calls to Acquire() can be made; these will not block. If the semaphore has been acquired more times than it has been released, it is called 'blocked'. Otherwise, it is called 'free'.
func NewSemaphore ¶
func NewSemaphore() Semaphore