types

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2023 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Reversed

func Reversed(s interface{})

Reversed 反转数组

Types

type ComparableHash

type ComparableHash interface {
	comparable
	Hash() uintptr
}

ComparableHash is a type constraint that matches all comparable types with a Hash method.

type ImpossibleConstraint

type ImpossibleConstraint interface {
	comparable
	[]int
}

ImpossibleConstraint is a type constraint that no type can satisfy, because slice types are not comparable.

type Integer

type Integer interface {
	~int8 | ~int16 | ~int32 | ~int64 | ~int | ~uint8 | ~uint16 | ~uint32 | ~uint64 | ~uint
}

type Number

type Number interface {
	~float32 | ~float64
}

type Ordered

type Ordered interface {
	~int | ~uint | ~float64 | ~string
}

Ordered 是匹配任何有序类型的类型约束. An ordered type is one that supports the <, <=, >, and >= operators.

type PyUVarInt

type PyUVarInt struct {
	Value uint64 // 解码后的值
	// contains filtered or unexported fields
}

func (*PyUVarInt) Build

func (pv *PyUVarInt) Build() []byte

Build 将一个uint64类型的数字编码成不定长的字节串

@return	编码后的字节串

func (*PyUVarInt) GetBytes

func (pv *PyUVarInt) GetBytes() []byte

GetBytes 获取字节串

func (*PyUVarInt) Parse

func (pv *PyUVarInt) Parse(data []byte) (uint64, int)

Parse 解析一个不定长的字节串为uint64数字

@return	解析后的数字、字节串的有效长度

type PyVarInt

type PyVarInt struct {
	Value int64 // 解码后的值
	// contains filtered or unexported fields
}

PyVarInt Python-construct VarInt类型的Golang实现

func (*PyVarInt) Build

func (pv *PyVarInt) Build() []byte

Build 将一个int64类型的数字编码成不定长的字节串

@return	编码后的字节串

func (*PyVarInt) GetBytes

func (pv *PyVarInt) GetBytes() []byte

GetBytes 获取字节串

func (*PyVarInt) Parse

func (pv *PyVarInt) Parse(data []byte) (int64, int)

Parse 解析一个不定长的字节串为int64数字

@return	解析后的数字、字节串的有效长度

type VarIntArray

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

VarIntArray 可变长数组

func MakeVarIntArray

func MakeVarIntArray(len, cap int) *VarIntArray

MakeVarIntArray 新建一个可变长数组

func (*VarIntArray) Append

func (a *VarIntArray) Append(element int)

Append 增加一个元素

func (*VarIntArray) AppendMany

func (a *VarIntArray) AppendMany(element ...int)

AppendMany 增加多个元素

func (*VarIntArray) Cap

func (a *VarIntArray) Cap() int

Cap 返回容量

func (*VarIntArray) Get

func (a *VarIntArray) Get(index int) int

Get 获取某个下标的元素

func (*VarIntArray) Len

func (a *VarIntArray) Len() int

Len 返回真实长度

type VarIntIface

type VarIntIface interface {
	GetBytes() []byte // 获取字节串
	Build() []byte
}

Jump to

Keyboard shortcuts

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