base

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2021 License: MIT Imports: 10 Imported by: 20

README

base

base

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	AcquireArgs = func() []interface{} {
		return argsPool.Get().([]interface{})
	}

	ReleaseArgs = func(args *[]interface{}) {
		if args == nil {
			return
		}

		*args = (*args)[:0]
		argsPool.Put(*args)
	}
)
View Source
var (
	ErrIpV4Address = errors.New(`invalid ip v4 address`)
)
View Source
var (
	SetValue = struct{}{}
)

Functions

func HashValue

func HashValue(key interface{}) uint32

func Index4Bit

func Index4Bit(key interface{}, bitCount uint8) uint32

func Index4Int16

func Index4Int16(key interface{}) int16

func Index4Int8

func Index4Int8(key interface{}) int8

func Index4Uint8

func Index4Uint8(key interface{}) uint8

func Ip2Long

func Ip2Long(ip string) (ipVal uint32, err error)

func JsonDecode

func JsonDecode(data []byte, v interface{}) (err error)

func JsonDecodeFile

func JsonDecodeFile(filePath string, v interface{}) (err error)

func JsonEncode

func JsonEncode(v interface{}) (data []byte, err error)

func Long2Ip

func Long2Ip(ipVal uint32) string

func YamlDecode

func YamlDecode(data []byte, v interface{}) (err error)

func YamlDecodeFile

func YamlDecodeFile(filePath string, v interface{}) (err error)

func YamlEncode

func YamlEncode(v interface{}) (data []byte, err error)

Types

type Bitmap

type Bitmap interface {
	HasBit() bool
	BitCount() int
	Exists(tag int) (exists bool)
	AddTag(tag int) Bitmap
	DelTag(tag int) Bitmap
	SprinfBinary() string
}

func NewBitmap

func NewBitmap(data []byte) Bitmap

type CanHash

type CanHash interface {
	HashCode() (hashValue uint32)
}

type HashSet

type HashSet interface {
	Add(items ...interface{}) (newNum int)
	Delete(items ...interface{}) (delNum int)
	Exists(item interface{}) (exists bool)
	Length() (length int)
}

func NewHashSet

func NewHashSet(size int) HashSet

type Msg

type Msg struct {
	Code int         `json:"code"`
	Msg  string      `json:"msg"`
	Data interface{} `json:"data"`
}

func (*Msg) Json

func (m *Msg) Json() (msg []byte)

type ShardMap

type ShardMap interface {
	Set(key interface{}, value interface{})
	Get(key interface{}) (value interface{}, exists bool)
	Exists(key interface{}) (exists bool)
	Delete(keys ...interface{})
	Length() int64
}

func NewShardMap

func NewShardMap() ShardMap

Jump to

Keyboard shortcuts

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