util

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Sep 2, 2024 License: GPL-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	RootPath       string
	Configurations map[string]string
)
View Source
var Log = log.New(os.Stdout, "[github.com/WlayRay/ElectricSearch]", log.Llongfile|log.Ldate|log.Ltime)

Functions

func BytesToInt

func BytesToInt(bs []byte) int

BytesToInt 字节转换成整型

func CombineUint32

func CombineUint32(a, b uint32) uint64

CombineUint32 把两个uint32拼接成一个uint64

func DisassembleUint64

func DisassembleUint64(x uint64) (uint32, uint32)

DisassembleUint64 把一个uint64拆成两个uint32

func GetCurrentPath

func GetCurrentPath() string

func GetLocalIP

func GetLocalIP() (ipv4 string, err error)

获取本机网卡IP(内网ip)

func IntToBytes

func IntToBytes(n int) []byte

IntToBytes 整型转换成字节

Types

type ConcurrentHashMap

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

func NewConcurrentHashMap

func NewConcurrentHashMap(segment int, capacity int) *ConcurrentHashMap

func (*ConcurrentHashMap) Get

func (c *ConcurrentHashMap) Get(key string) (any, bool)

func (*ConcurrentHashMap) NewIterator

func (c *ConcurrentHashMap) NewIterator() *ConcurrentHashMapIterator

func (*ConcurrentHashMap) Set

func (c *ConcurrentHashMap) Set(key string, value any)

type ConcurrentHashMapIterator

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

func (*ConcurrentHashMapIterator) Next

func (iter *ConcurrentHashMapIterator) Next() *MapEntry

type MapEntry

type MapEntry struct {
	Key   string
	Value any
}

迭代器模式

type MapIterator

type MapIterator interface {
	Next() *MapEntry
}

type Worker

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

func NewWorker

func NewWorker(workerId uint64) (*Worker, error)

func (*Worker) GetId

func (w *Worker) GetId() uint64

func (*Worker) GetWorkerId

func (w *Worker) GetWorkerId() uint64

Jump to

Keyboard shortcuts

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