Utils

package
v0.0.0-...-5771147 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2021 License: Apache-2.0 Imports: 29 Imported by: 0

Documentation

Overview

轻量级单对象并行运行池 会产生一定的数据COPY version 1.0 beta by koangel email: jackliu100@gmail.com 2017/12/18

部分位置用于取代CHAN的无限无阻塞队列 version 1.0 beta 需要特别的LOCKFREE队列 ,尝试 github.com/yireyun/go-queue by koangel email: jackliu100@gmail.com 2018/04/13

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Crc32IEEE

func Crc32IEEE(data []byte) uint32

func Crc64ECMA

func Crc64ECMA(data []byte) uint64

func Crc64ISO

func Crc64ISO(data []byte) uint64

func FastGZipMsg

func FastGZipMsg(src []byte, isBase64 bool) (data []byte, err error)

快速压缩一个数据内存 不支持大数据,不要用来压缩较大文件

func FastUnGZipMsg

func FastUnGZipMsg(src []byte, isBase64 bool) (data []byte, err error)

快速解压一个消息 不支持大数据,不要用来解压缩较大文件

func HMac_MD5

func HMac_MD5(data, key []byte) string

func HMac_MD5Bytes

func HMac_MD5Bytes(data, key []byte) []byte

func HMac_SHA1

func HMac_SHA1(data, key []byte) string

func HMac_SHA1Bytes

func HMac_SHA1Bytes(data, key []byte) []byte

func HMac_SHA256

func HMac_SHA256(data, key []byte) string

func HMac_SHA256Bytes

func HMac_SHA256Bytes(data, key []byte) []byte

func HMac_SHA512

func HMac_SHA512(data, key []byte) string

func HMac_SHA512Bytes

func HMac_SHA512Bytes(data, key []byte) []byte

func If

func If(cond bool, a interface{}, b interface{}) interface{}

当cond为true 返回a 否则返回b 支持a,b为任意不同的类型

func Ifd

func Ifd(cond bool, a float64, b float64) float64

func Ifn

func Ifn(cond bool, a int, b int) int

func Ifn32

func Ifn32(cond bool, a int32, b int32) int32

func Ifn64

func Ifn64(cond bool, a int, b int64) int64

func Ifs

func Ifs(cond bool, a string, b string) string

日常类通用模块

func Ifun32

func Ifun32(cond bool, a uint32, b uint32) uint32

func Ifun64

func Ifun64(cond bool, a uint64, b uint64) uint64

func MD5

func MD5(data []byte) string

func MD5Bytes

func MD5Bytes(data []byte) []byte

func MergeBinary

func MergeBinary(src ...[]byte) []byte

func MustBool

func MustBool(v interface{}, must bool) bool

func MustFloat64

func MustFloat64(v interface{}, must float64) float64

func MustInt

func MustInt(v interface{}, must int) int

func MustInt64

func MustInt64(v interface{}, must int64) int64

func MustString

func MustString(v interface{}) string

func MustUInt64

func MustUInt64(v interface{}, must uint64) uint64

func PanicTrace

func PanicTrace(kb int) []byte

func RunDaemon

func RunDaemon(name string, desc string, sWork string, handler DaemonHandler) error

func SHA1

func SHA1(data []byte) string

func SHA1Bytes

func SHA1Bytes(data []byte) []byte

func SHA256

func SHA256(data []byte) string

func SHA256Bytes

func SHA256Bytes(data []byte) []byte

func SHA512

func SHA512(data []byte) string

func SHA512Bytes

func SHA512Bytes(data []byte) []byte

func SplitBinary

func SplitBinary(src []byte) [][]byte

/ 拆分 合并后的[]bytes

Types

type AVGLimit

type AVGLimit struct {
	// contains filtered or unexported fields
}

平均数值同步计算容器

func (*AVGLimit) Add

func (c *AVGLimit) Add(value float64)

func (*AVGLimit) Reset

func (c *AVGLimit) Reset()

func (*AVGLimit) String

func (c *AVGLimit) String() string

func (*AVGLimit) Value

func (c *AVGLimit) Value() float64

type DaemonHandler

type DaemonHandler func(signal chan os.Signal) string

type LimitContiner

type LimitContiner struct {
	// contains filtered or unexported fields
}

统计类的LIMIT库,限制数量 多线程同步的限制数量

func NewLC

func NewLC(lc int) *LimitContiner

func (*LimitContiner) Add

func (l *LimitContiner) Add(val interface{})

func (*LimitContiner) Back

func (l *LimitContiner) Back() (value interface{}, ok bool)

func (*LimitContiner) Clear

func (l *LimitContiner) Clear()

func (*LimitContiner) Foreach

func (l *LimitContiner) Foreach(fn func(n interface{}))

func (*LimitContiner) Front

func (l *LimitContiner) Front() (value interface{}, ok bool)

func (*LimitContiner) Len

func (l *LimitContiner) Len() int

func (*LimitContiner) MatchLimit

func (l *LimitContiner) MatchLimit(fn func(n interface{}) bool, limit int) bool

func (*LimitContiner) Search

func (l *LimitContiner) Search(fn func(n interface{}) bool) bool

type StringLimit

type StringLimit struct {
	// contains filtered or unexported fields
}

func NewSL

func NewSL(ls int) *StringLimit

func (*StringLimit) LineMatch

func (l *StringLimit) LineMatch(limit int) bool

func (*StringLimit) LineNSuffix

func (l *StringLimit) LineNSuffix(limit int) bool

func (*StringLimit) Match

func (l *StringLimit) Match(val string, limit int) bool

func (*StringLimit) MatchPrefix

func (l *StringLimit) MatchPrefix(src string, limit int) bool

func (*StringLimit) Push

func (l *StringLimit) Push(v string)

func (*StringLimit) Search

func (l *StringLimit) Search(val string) bool

func (*StringLimit) Strings

func (l *StringLimit) Strings() []string

type SyncJob

type SyncJob struct {
	// contains filtered or unexported fields
}

func (*SyncJob) Append

func (job *SyncJob) Append(fn jobhandler, args ...interface{}) error

func (*SyncJob) AppendR

func (job *SyncJob) AppendR(fn, rcall jobhandler, args ...interface{}) error

func (*SyncJob) SliceJob

func (job *SyncJob) SliceJob(slice interface{}, breakup int, fn func(start, end int))

func (*SyncJob) StartWait

func (job *SyncJob) StartWait()

type SyncQueue

type SyncQueue struct {
	// contains filtered or unexported fields
}

func NewSQueue

func NewSQueue() *SyncQueue

func (*SyncQueue) Pop

func (q *SyncQueue) Pop() (val interface{})

func (*SyncQueue) Push

func (q *SyncQueue) Push(value interface{})

Jump to

Keyboard shortcuts

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