helper

package
v0.0.0-...-5defee7 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2023 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetBit

func GetBit(b byte, idx int) byte

idx: [0, 7]

func Hash

func Hash(bs []byte) uint64

func Int16ToBinary

func Int16ToBinary(i int16) []byte

func Int24ToBinary

func Int24ToBinary(i int32) []byte

func Int32ToBinary

func Int32ToBinary(i int32) []byte

func Int64ToBinary

func Int64ToBinary(i int64) []byte

func Int8ToBinary

func Int8ToBinary(i int8) []byte

func SearchFirstGreaterEqual

func SearchFirstGreaterEqual(ss SequentialSequence, data int64) (idx uint32, found bool)

搜索顺序序列中,第一个大于等于 data 的序号,返回是 [0, n] - 为空,返回 0 - 比所有值都小,返回 0 - 比所有值都大,返回 n - 至少比一个值大,但是又不是比所有的值都大,返回范围是 [1, n-1]

func String

func String(data interface{}) string

Types

type CompareResult

type CompareResult int

func Compare

func Compare(a, b interface{}) CompareResult

a > b, 1 a == b, 0 a < b, -1

func (CompareResult) IsBigger

func (c CompareResult) IsBigger() bool

func (CompareResult) IsEqual

func (c CompareResult) IsEqual() bool

func (CompareResult) IsSmall

func (c CompareResult) IsSmall() bool

type IntSequentialSequence

type IntSequentialSequence []int

func (IntSequentialSequence) GetData

func (r IntSequentialSequence) GetData(idx uint32) int64

func (IntSequentialSequence) Len

func (r IntSequentialSequence) Len() uint32

type SequentialSequence

type SequentialSequence interface {
	GetData(idx uint32) int64
	Len() uint32
}

顺序的序列 - 可以获取长度 - 可以根据偏移获取指定的值

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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