util

package
v0.0.0-...-b5fea6e Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 16, 2022 License: Apache-2.0 Imports: 13 Imported by: 0

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

View Source
const (
	GBK     Charset = "GBK"
	GB18030         = "GB18030"
	GB2312          = "GB2312"
	Big5            = "Big5"
)

中文

View Source
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 Coalesce

func Coalesce(arg1 interface{}, arg2 interface{}, args ...interface{}) interface{}

func Convert

func Convert(dstCharset Charset, srcCharset Charset, src string) (dst string, err error)

func MergeErrs

func MergeErrs(chs ...<-chan error) <-chan error

func Noop

func Noop()

func ResolveSelfIP

func ResolveSelfIP() (net.IP, error)

func StrPtrEq

func StrPtrEq(a *string, b *string) bool

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 ToUTF8

func ToUTF8(srcCharset Charset, src string) (dst string, err error)

func UTF8To

func UTF8To(dstCharset Charset, src string) (dst string, err error)

func UTF8ToGB2312

func UTF8ToGB2312(s []byte) []byte

func Uint16PtrEq

func Uint16PtrEq(a *uint16, b *uint16) bool

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 Charset

type Charset string

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL