Documentation ¶
Index ¶
- Constants
- Variables
- func AddExactInt64(x, y int64) int64
- func BoolArraySame(array1 []bool, array2 []bool) bool
- func BoolsLenInt32(b []bool) int32
- func ByteSliceToString(b []byte) string
- func BytesLenInt32(b []byte) int32
- func BytesToInt64(buf []byte, i int) int64
- func CheckArgument(expression bool)
- func CheckArgument2(expression bool, msg string)
- func CheckNotNull[T basic.Object](reference T) T
- func CheckState(expression bool)
- func CheckState2(expression bool, msg string)
- func CopyArrays[T basic.Object](from []T, srcPos int32, dest []T, destPos int32, length int32)
- func CopyBools(from []bool, srcPos int32, dest []bool, destPos int, length int32)
- func CopyBoolsOfRange(original []bool, from int32, to int32) []bool
- func CopyBytes(from []byte, srcPos int32, dest []byte, destPos int32, length int32)
- func CopyFloat64s(from []float64, srcPos int32, dest []float64, destPos int32, length int32)
- func CopyInt16s(from []int16, srcPos int32, dest []int16, destPos int32, length int32)
- func CopyInt16sOfRange(original []int16, from int32, to int32) []int16
- func CopyInt32s(from []int32, srcPos int32, dest []int32, destPos int32, length int32)
- func CopyInt32sOfRange(original []int32, from int32, to int32) []int32
- func CopyInt64s(from []int64, srcPos int32, dest []int64, destPos int32, length int32)
- func CopyOfBools(original []bool, newLength int32) []bool
- func CopyOfBytes(original []byte, newLength int32) []byte
- func CopyOfFloat64s(original []float64, newLength int32) []float64
- func CopyOfInt16s(original []int16, newLength int32) []int16
- func CopyOfInt32(original []int32, newLength int32) []int32
- func CopyOfInt64s(original []int64, newLength int32) []int64
- func EmptyMap[K basic.ComObj, V basic.Object]() map[K]V
- func FillArrays[T basic.Object](array []T, index int32, length int32, value T)
- func FillInt32Range(a []int32, start int32, end int32, value int32)
- func FillInt32s(array []int32, value int32)
- func FillInt64s(array []int64, value int64)
- func FilterKeys[K basic.ComObj, V basic.Object](src map[K]V, f func(K) bool) map[K]V
- func GetBool(buf []byte) bool
- func GetByte(buf []byte) byte
- func GetFloat32(buf []byte) float32
- func GetFloat64(buf []byte) float64
- func GetInt16(buf []byte) (n int16)
- func GetInt32(buf []byte) (n int32)
- func GetInt64(buf []byte) (n int64)
- func GetInt8(buf []byte) (n int8)
- func GetUint16(buf []byte) (n uint16)
- func GetUint32(buf []byte) (n uint32)
- func GetUint64(buf []byte) (n uint64)
- func GetUint8(buf []byte) (n uint8)
- func If(cond bool, a, b interface{}) interface{}
- func Int16sLenInt32(b []int16) int32
- func Int32Exact(value int64) int32
- func Int32ExactU(value uint64) int32
- func Int32sLenInt32(b []int32) int32
- func Int64sLenInt32(b []int64) int32
- func IntSlice(s SetInterface[int]) []int
- func JoinNums[T basic.Numbers](elems []T, sep string) string
- func Lens[T basic.Object](a []T) int32
- func LensInt64[T basic.Object](a []T) int64
- func Md5Hash(data []byte) string
- func Md5HashBytes(data []byte) []byte
- func NewMap[K basic.ComObj, V basic.Object](k K, v V) map[K]V
- func ParseInt(str string, offset int32, length int32, base int32) int32
- func ParseInt64(str string, offset int32, length int32, base int32) int64
- func PutAll[K basic.ComObj, V basic.Object](dest map[K]V, src map[K]V)
- func QuickSortIndirect(perm []int32, x []float64, from int32, to int32)
- func ReverseNums[T basic.Object](array []T, fromIndex int32, toIndex int32)
- func Sha1Hash(data []byte) string
- func Sha1HashBytes(data []byte) []byte
- func SizeOf(t basic.Object) int32
- func SizeOfInt64(t basic.Object) int64
- func StringSlice(s SetInterface[string]) []string
- func Strval(value interface{}) string
- func SubStrNoEnd(source string, start int) string
- func Substring(source string, start int, end int) string
- func Ternary[T basic.Object](cond bool, a, b T) T
- func ToArrayT[S basic.Object, T basic.Object](list *ArrayList[S]) []T
- func ToByteExact(value int64) (byte, error)
- func ToInt16Exact(value int64) (int16, error)
- func ToInt32Exact(value int64) (int32, error)
- func ToInt8Exact(value int64) (int8, error)
- func ToIntExact(value int64) (int, error)
- func Try(f func(), catch func(interface{}), finally func())
- func UniqueIndex[K basic.ComObj, V basic.Object](values *ArrayList[V], keyFunction func(v V) K) map[K]V
- func Verify(expression bool)
- func Verify2(expression bool, msg string)
- func WriteBool(buf []byte, b bool)
- func WriteByte(buf []byte, n byte)
- func WriteFloat32(buf []byte, n float32)
- func WriteFloat64(buf []byte, n float64)
- func WriteInt16(buf []byte, n int16)
- func WriteInt32(buf []byte, n int32)
- func WriteInt64(buf []byte, n int64)
- func WriteInt8(buf []byte, n int8)
- func WriteSOffsetT(buf []byte, n SOffsetT)
- func WriteUOffsetT(buf []byte, n UOffsetT)
- func WriteUint16(buf []byte, n uint16)
- func WriteUint32(buf []byte, n uint32)
- func WriteUint64(buf []byte, n uint64)
- func WriteUint8(buf []byte, n uint8)
- func WriteVOffsetT(buf []byte, n VOffsetT)
- type ArrayList
- func EMPTY_LIST[T basic.Object]() *ArrayList[T]
- func MapKeys[K basic.ComObj, V basic.Object](src map[K]V) *ArrayList[K]
- func MapValues[K basic.ComObj, V basic.Object](src map[K]V) *ArrayList[V]
- func NewArrayList[T basic.Object](values ...T) *ArrayList[T]
- func NewCmpList[T basic.Object](cmp Compare[T]) *ArrayList[T]
- func NewCmpListWithValues[T basic.Object](cmp Compare[T], values ...T) *ArrayList[T]
- func (list *ArrayList[T]) Add(values ...T) List[T]
- func (list *ArrayList[T]) AddAll(values List[T]) List[T]
- func (list *ArrayList[T]) AddAllIndex(index int32, values List[T]) List[T]
- func (list *ArrayList[T]) AddIndex(index int32, values ...T) List[T]
- func (list *ArrayList[T]) Clear()
- func (list *ArrayList[T]) Contains(value T) bool
- func (list *ArrayList[T]) ForEach(f func(T))
- func (list *ArrayList[T]) Get(index int) T
- func (list *ArrayList[T]) GetByInt32(index int32) T
- func (list *ArrayList[T]) IsEmpty() bool
- func (list *ArrayList[T]) Iter() Iterator[T]
- func (list *ArrayList[T]) Len() int
- func (list *ArrayList[T]) Less(i, j int) bool
- func (list *ArrayList[T]) Remove(index int) T
- func (list *ArrayList[T]) Size() int
- func (list *ArrayList[T]) SizeInt32() int32
- func (list *ArrayList[T]) Stream() *Stream[T]
- func (list *ArrayList[T]) SubList(start int, end int) *ArrayList[T]
- func (list *ArrayList[T]) Swap(i, j int)
- func (list *ArrayList[T]) ToArray() []T
- type Compare
- type CopiesList
- func (ct *CopiesList[T]) Add(values ...T) List[T]
- func (ct *CopiesList[T]) AddAll(values List[T]) List[T]
- func (ct *CopiesList[T]) AddAllIndex(index int32, values List[T]) List[T]
- func (ct *CopiesList[T]) AddIndex(index int32, values ...T) List[T]
- func (ct *CopiesList[T]) Clear()
- func (ct *CopiesList[T]) Contains(value T) bool
- func (ct *CopiesList[T]) ForEach(f func(T))
- func (ct *CopiesList[T]) Get(index int) T
- func (ct *CopiesList[T]) IsEmpty() bool
- func (ct *CopiesList[T]) Iter() Iterator[T]
- func (ct *CopiesList[T]) Remove(index int) T
- func (ct *CopiesList[T]) Size() int
- func (ct *CopiesList[T]) Stream() *Stream[T]
- func (ct *CopiesList[T]) ToArray() []T
- type DataSize
- func (b DataSize) Bytes() uint64
- func (b DataSize) EBytes() float64
- func (b DataSize) GBytes() float64
- func (b DataSize) HR() string
- func (b DataSize) HumanReadable() string
- func (b DataSize) KBytes() float64
- func (b DataSize) MBytes() float64
- func (b DataSize) MarshalText() ([]byte, error)
- func (b DataSize) PBytes() float64
- func (b DataSize) String() string
- func (b DataSize) TBytes() float64
- func (b *DataSize) UnmarshalText(t []byte) error
- type Int32Stream
- func (s *Int32Stream) Add(i int32) *Int32Stream
- func (s *Int32Stream) Addall(i ...int32) *Int32Stream
- func (s *Int32Stream) Filter(f func(int32) bool) *Int32Stream
- func (s *Int32Stream) FoldLeft(i *Int32Stream, f func(*Int32Stream, int32) *Int32Stream) *Int32Stream
- func (s *Int32Stream) FoldRight(i *Int32Stream, f func(*Int32Stream, int32) *Int32Stream) *Int32Stream
- func (s *Int32Stream) Merge(t *Int32Stream) *Int32Stream
- func (s *Int32Stream) Reduce(i int32, f func(int32, int32) int32) int32
- func (s *Int32Stream) Reverse() *Int32Stream
- func (s *Int32Stream) Sort(c func(int32, int32) bool) *Int32Stream
- func (s *Int32Stream) Sum() int32
- type Iterable
- type Iterator
- type List
- type LongStream
- func (s *LongStream) Add(i int64) *LongStream
- func (s *LongStream) Addall(i ...int64) *LongStream
- func (s *LongStream) Filter(f func(int64) bool) *LongStream
- func (s *LongStream) FoldLeft(i *LongStream, f func(*LongStream, int64) *LongStream) *LongStream
- func (s *LongStream) FoldRight(i *LongStream, f func(*LongStream, int64) *LongStream) *LongStream
- func (s *LongStream) Merge(t *LongStream) *LongStream
- func (s *LongStream) Reduce(i int64, f func(int64, int64) int64) int64
- func (s *LongStream) Reverse() *LongStream
- func (s *LongStream) Sort(c func(int64, int64) bool) *LongStream
- func (s *LongStream) Sum() int64
- type MothMap
- type Predicate
- type SOffsetT
- type Set
- func (s *Set[T]) Add(items ...T)
- func (s *Set[T]) Clear()
- func (s *Set[T]) Copy() SetInterface[T]
- func (s *Set[T]) Each(f func(item T) bool)
- func (s *Set[T]) ForEach(f func(T))
- func (s *Set[T]) Has(items ...T) bool
- func (s *Set) IsEmpty() bool
- func (s *Set[T]) IsEqual(t SetInterface[T]) bool
- func (s *Set[T]) IsSubset(t SetInterface[T]) (subset bool)
- func (s *Set) IsSuperset(t SetInterface[T]) bool
- func (s *Set[T]) List() []T
- func (s *Set[T]) Merge(t SetInterface[T])
- func (s *Set[T]) Pop() T
- func (s *Set[T]) Remove(items ...T)
- func (s *Set) Separate(t SetInterface[T])
- func (s *Set[T]) Size() int
- func (s *Set[T]) Stream() *Stream[T]
- func (s *Set) String() string
- type SetInterface
- func Difference[T basic.ComObj](set1, set2 SetInterface[T], sets ...SetInterface[T]) SetInterface[T]
- func EmptySet[T basic.ComObj]() SetInterface[T]
- func Intersection[T basic.ComObj](set1, set2 SetInterface[T], sets ...SetInterface[T]) SetInterface[T]
- func NewSet[T basic.ComObj](settype SetType) SetInterface[T]
- func NewSetWithItems[T basic.ComObj](settype SetType, items ...T) SetInterface[T]
- func SymmetricDifference[T basic.ComObj](s SetInterface[T], t SetInterface[T]) SetInterface[T]
- func Union[T basic.ComObj](set1, set2 SetInterface[T], sets ...SetInterface[T]) SetInterface[T]
- type SetMap
- type SetNonTS
- func (s *SetNonTS) Add(items ...T)
- func (s *SetNonTS) Clear()
- func (s *SetNonTS) Copy() SetInterface[T]
- func (s *SetNonTS) Each(f func(item T) bool)
- func (s *SetNonTS) ForEach(f func(item T))
- func (s *SetNonTS) Has(items ...T) bool
- func (s *SetNonTS) IsEmpty() bool
- func (s *SetNonTS) IsEqual(t SetInterface[T]) bool
- func (s *SetNonTS) IsSubset(t SetInterface[T]) (subset bool)
- func (s *SetNonTS) IsSuperset(t SetInterface[T]) bool
- func (s *SetNonTS) List() []T
- func (s *SetNonTS) Merge(t SetInterface[T])
- func (s *SetNonTS) Pop() T
- func (s *SetNonTS) Remove(items ...T)
- func (s *SetNonTS) Separate(t SetInterface[T])
- func (s *SetNonTS) Size() int
- func (s *SetNonTS) Stream() *Stream[T]
- func (s *SetNonTS) String() string
- type SetType
- type Stream
- func GenStream[T basic.Object](r *Stream[T], f func(*Stream[T]) T, m int) *Stream[T]
- func MapInt32[R basic.Object](s *Int32Stream, f func(t int32) R) *Stream[R]
- func MapLong[R basic.Object](s *LongStream, f func(t int64) R) *Stream[R]
- func MapStream[T basic.Object, R basic.Object](s *Stream[T], f func(t T) R) *Stream[R]
- func NewStream[T basic.Object](head T, tail *Stream[T]) *Stream[T]
- func NullStream[T basic.Object]() *Stream[T]
- func (s *Stream[T]) Add(i T) *Stream[T]
- func (s *Stream[T]) Addall(i ...T) *Stream[T]
- func (s *Stream[T]) AnyMatch(f func(T) bool) bool
- func (s *Stream[T]) Filter(f func(T) bool) *Stream[T]
- func (s *Stream[T]) FoldLeft(i *Stream[T], f func(*Stream[T], T) *Stream[T]) *Stream[T]
- func (s *Stream[T]) FoldRight(i *Stream[T], f func(*Stream[T], T) *Stream[T]) *Stream[T]
- func (s *Stream[T]) ForEach(f func(T))
- func (s *Stream[T]) MapToInt32(f func(t T) int32) *Int32Stream
- func (s *Stream[T]) MapToLong(f func(t T) int64) *LongStream
- func (s *Stream[T]) Merge(t *Stream[T]) *Stream[T]
- func (s *Stream[T]) Reduce(i T, f func(T, T) T) T
- func (s *Stream[T]) Reverse() *Stream[T]
- func (s *Stream[T]) Sort(c func(T, T) bool) *Stream[T]
- func (s *Stream[T]) ToList() *ArrayList[T]
- type StringBuilder
- func (b *StringBuilder) AddBool(key string, value bool) *StringBuilder
- func (b *StringBuilder) AddFloat32(key string, value float32) *StringBuilder
- func (b *StringBuilder) AddFloat64(key string, value float64) *StringBuilder
- func (b *StringBuilder) AddInt(key string, value int) *StringBuilder
- func (b *StringBuilder) AddInt16(key string, value int16) *StringBuilder
- func (b *StringBuilder) AddInt32(key string, value int32) *StringBuilder
- func (b *StringBuilder) AddInt64(key string, value int64) *StringBuilder
- func (b *StringBuilder) AddInt8(key string, value int8) *StringBuilder
- func (b *StringBuilder) AddString(key string, value string) *StringBuilder
- func (b *StringBuilder) AddUInt64(key string, value uint64) *StringBuilder
- func (b *StringBuilder) AppendBool(i bool) *StringBuilder
- func (b *StringBuilder) AppendChar(i byte) *StringBuilder
- func (b *StringBuilder) AppendFloat32(i float32) *StringBuilder
- func (b *StringBuilder) AppendFloat64(i float64) *StringBuilder
- func (b *StringBuilder) AppendInt(i int) *StringBuilder
- func (b *StringBuilder) AppendInt16(i int16) *StringBuilder
- func (b *StringBuilder) AppendInt32(i int32) *StringBuilder
- func (b *StringBuilder) AppendInt64(i int64) *StringBuilder
- func (b *StringBuilder) AppendInt8(i int8) *StringBuilder
- func (b *StringBuilder) AppendString(i string) *StringBuilder
- func (b *StringBuilder) AppendUInt32(i uint32) *StringBuilder
- func (b *StringBuilder) AppendUInt64(i uint64) *StringBuilder
- func (b *StringBuilder) Length() int
- func (b *StringBuilder) SetLength(len int) *StringBuilder
- func (b *StringBuilder) String() string
- func (b *StringBuilder) ToStringHelper() string
- type UOffsetT
- type VOffsetT
Constants ¶
const ( B DataSize = 1 KB = B << 10 MB = KB << 10 GB = MB << 10 TB = GB << 10 PB = TB << 10 EB = PB << 10 )
const ( BYTE_BYTES = 1 INT8_BYTES = 1 INT16_BYTES = 2 INT32_BYTES = 4 INT64_BYTES = 8 INT128_BYTES = 16 FLOAT32_BYTES = 4 FLOAT64_BYTES = 8 INT64_SIZE = 64 )
const ( // SizeUint8 is the byte size of a uint8. SizeUint8 = 1 // SizeUint16 is the byte size of a uint16. SizeUint16 = 2 // SizeUint32 is the byte size of a uint32. SizeUint32 = 4 // SizeUint64 is the byte size of a uint64. SizeUint64 = 8 // SizeInt8 is the byte size of a int8. SizeInt8 = 1 // SizeInt16 is the byte size of a int16. SizeInt16 = 2 // SizeInt32 is the byte size of a int32. SizeInt32 = 4 // SizeInt64 is the byte size of a int64. SizeInt64 = 8 // SizeFloat32 is the byte size of a float32. SizeFloat32 = 4 // SizeFloat64 is the byte size of a float64. SizeFloat64 = 8 // SizeByte is the byte size of a byte. // The `byte` type is aliased (by Go definition) to uint8. SizeByte = 1 // SizeBool is the byte size of a bool. // The `bool` type is aliased (by flatbuffers convention) to uint8. SizeBool = 1 // SizeSOffsetT is the byte size of an SOffsetT. // The `SOffsetT` type is aliased (by flatbuffers convention) to int32. SizeSOffsetT = 4 // SizeUOffsetT is the byte size of an UOffsetT. // The `UOffsetT` type is aliased (by flatbuffers convention) to uint32. SizeUOffsetT = 4 // SizeVOffsetT is the byte size of an VOffsetT. // The `VOffsetT` type is aliased (by flatbuffers convention) to uint16. SizeVOffsetT = 2 )
const ( SET_ThreadSafe = iota SET_NonThreadSafe )
const (
// VtableMetadataFields is the count of metadata fields in each vtable.
VtableMetadataFields = 2
)
Variables ¶
var ( INT16_ZERO int16 = 0 INT32_ZERO int32 = 0 INT64_ZERO int64 = 0 FLOAT64_ZERO float64 = 0 )
var (
EMPTY = []byte{}
)
basic map
var ErrBits = errors.New("unit with capital unit prefix and lower case unit (b) - bits, not bytes ")
var QUICKSORT_MEDIAN_OF_9 int32 = 128
var QUICKSORT_NO_REC int32 = 16
Functions ¶
func AddExactInt64 ¶
func BoolArraySame ¶
func ByteSliceToString ¶
byteSliceToString converts a []byte to string without a heap allocation.
func BytesToInt64 ¶
func CheckArgument ¶
func CheckArgument(expression bool)
func CheckArgument2 ¶
func CheckNotNull ¶
func CheckState ¶
func CheckState(expression bool)
func CheckState2 ¶
func CopyArrays ¶
func CopyFloat64s ¶
func CopyInt16s ¶
func CopyInt32s ¶
func CopyInt64s ¶
func CopyOfBools ¶
func CopyOfBytes ¶
func CopyOfFloat64s ¶
func CopyOfInt16s ¶
func CopyOfInt32 ¶
func CopyOfInt64s ¶
func FillInt32s ¶
func FillInt64s ¶
func FilterKeys ¶
func GetFloat32 ¶
GetFloat32 decodes a little-endian float32 from a byte slice.
func GetFloat64 ¶
GetFloat64 decodes a little-endian float64 from a byte slice.
func Int16sLenInt32 ¶
func Int32Exact ¶
func Int32ExactU ¶
func Int64sLenInt32 ¶
func IntSlice ¶
func IntSlice(s SetInterface[int]) []int
IntSlice is a helper function that returns a slice of ints of s. If the set contains mixed types of items only items of type int are returned.
func Md5HashBytes ¶
func QuickSortIndirect ¶
*
- Sorts the specified range of elements according to the natural ascending
- order using indirect quicksort. *
- <p>
- The sorting algorithm is a tuned quicksort adapted from Jon L. Bentley and M.
- Douglas McIlroy, “Engineering a Sort Function”, <i>Software:
- Practice and Experience</i>, 23(11), pages 1249−1265, 1993. *
- <p>
- This method implement an <em>indirect</em> sort. The elements of {@code perm}
- (which must be exactly the numbers in the interval {@code [0..perm.length)})
- will be permuted so that {@code x[perm[i]] ≤ x[perm[i + 1]]}. *
- <p>
- Note that this implementation does not allocate any object, contrarily to the
- implementation used to sort primitive types in {@link java.util.Arrays},
- which switches to mergesort on large inputs. *
- @param perm a permutation array indexing {@code x}.
- @param x the array to be sorted.
- @param from the index of the first element (inclusive) to be sorted.
- @param to the index of the last element (exclusive) to be sorted.
func Sha1HashBytes ¶
func SizeOfInt64 ¶
func StringSlice ¶
func StringSlice(s SetInterface[string]) []string
StringSlice is a helper function that returns a slice of strings of s. If the set contains mixed types of items only items of type string are returned.
func Strval ¶
func Strval(value interface{}) string
Strval 获取变量的字符串值 浮点型 3.0将会转换成字符串3, "3" 非数值或字符类型的变量将会被转换成JSON格式字符串
func SubStrNoEnd ¶
func Substring ¶
获取source的子串,如果start小于0或者end大于source长度则返回"" start:开始index,从0开始,包括0 end:结束index,以end结束,但不包括end
func ToByteExact ¶
func ToInt16Exact ¶
func ToInt32Exact ¶
func ToInt8Exact ¶
func ToIntExact ¶
func UniqueIndex ¶
func WriteFloat32 ¶
WriteFloat32 encodes a little-endian float32 into a byte slice.
func WriteFloat64 ¶
WriteFloat64 encodes a little-endian float64 into a byte slice.
func WriteInt16 ¶
WriteInt16 encodes a little-endian int16 into a byte slice.
func WriteInt32 ¶
WriteInt32 encodes a little-endian int32 into a byte slice.
func WriteInt64 ¶
WriteInt64 encodes a little-endian int64 into a byte slice.
func WriteSOffsetT ¶
WriteSOffsetT encodes a little-endian SOffsetT into a byte slice.
func WriteUOffsetT ¶
WriteUOffsetT encodes a little-endian UOffsetT into a byte slice.
func WriteUint16 ¶
WriteUint16 encodes a little-endian uint16 into a byte slice.
func WriteUint32 ¶
WriteUint32 encodes a little-endian uint32 into a byte slice.
func WriteUint64 ¶
WriteUint64 encodes a little-endian uint64 into a byte slice.
func WriteUint8 ¶
WriteUint8 encodes a little-endian uint8 into a byte slice.
func WriteVOffsetT ¶
WriteVOffsetT encodes a little-endian VOffsetT into a byte slice.
Types ¶
type ArrayList ¶
type ArrayList[T basic.Object] struct { // 继承 List[T] // 继承 sort.Interface // contains filtered or unexported fields }
func EMPTY_LIST ¶
func NewArrayList ¶
func NewCmpListWithValues ¶
func (*ArrayList[T]) AddAllIndex ¶
func (*ArrayList[T]) GetByInt32 ¶
type CopiesList ¶
func (*CopiesList[T]) Add ¶
func (ct *CopiesList[T]) Add(values ...T) List[T]
func (*CopiesList[T]) AddAll ¶
func (ct *CopiesList[T]) AddAll(values List[T]) List[T]
func (*CopiesList[T]) AddAllIndex ¶
func (ct *CopiesList[T]) AddAllIndex(index int32, values List[T]) List[T]
func (*CopiesList[T]) AddIndex ¶
func (ct *CopiesList[T]) AddIndex(index int32, values ...T) List[T]
func (*CopiesList[T]) Clear ¶
func (ct *CopiesList[T]) Clear()
func (*CopiesList[T]) Contains ¶
func (ct *CopiesList[T]) Contains(value T) bool
func (*CopiesList[T]) ForEach ¶
func (ct *CopiesList[T]) ForEach(f func(T))
func (*CopiesList[T]) Get ¶
func (ct *CopiesList[T]) Get(index int) T
func (*CopiesList[T]) IsEmpty ¶
func (ct *CopiesList[T]) IsEmpty() bool
func (*CopiesList[T]) Iter ¶
func (ct *CopiesList[T]) Iter() Iterator[T]
func (*CopiesList[T]) Remove ¶
func (ct *CopiesList[T]) Remove(index int) T
func (*CopiesList[T]) Size ¶
func (ct *CopiesList[T]) Size() int
func (*CopiesList[T]) Stream ¶
func (ct *CopiesList[T]) Stream() *Stream[T]
func (*CopiesList[T]) ToArray ¶
func (ct *CopiesList[T]) ToArray() []T
type DataSize ¶
type DataSize uint64
func MustParseString ¶
func ParseString ¶
func (DataSize) HumanReadable ¶
func (DataSize) MarshalText ¶
func (*DataSize) UnmarshalText ¶
type Int32Stream ¶
type Int32Stream struct { Head int32 Tail *Int32Stream Length int NotEmpty bool }
func GenInt32Stream ¶
func GenInt32Stream(r *Int32Stream, f func(*Int32Stream) int32, m int) *Int32Stream
func NewInt32Stream ¶
func NewInt32Stream(head int32, tail *Int32Stream) *Int32Stream
func NullInt32 ¶
func NullInt32() *Int32Stream
func (*Int32Stream) Add ¶
func (s *Int32Stream) Add(i int32) *Int32Stream
func (*Int32Stream) Addall ¶
func (s *Int32Stream) Addall(i ...int32) *Int32Stream
func (*Int32Stream) Filter ¶
func (s *Int32Stream) Filter(f func(int32) bool) *Int32Stream
func (*Int32Stream) FoldLeft ¶
func (s *Int32Stream) FoldLeft(i *Int32Stream, f func(*Int32Stream, int32) *Int32Stream) *Int32Stream
左折叠 用于实现 reduce 的功能
func (*Int32Stream) FoldRight ¶
func (s *Int32Stream) FoldRight(i *Int32Stream, f func(*Int32Stream, int32) *Int32Stream) *Int32Stream
右折叠
func (*Int32Stream) Merge ¶
func (s *Int32Stream) Merge(t *Int32Stream) *Int32Stream
合并两个 Int32Stream
func (*Int32Stream) Sort ¶
func (s *Int32Stream) Sort(c func(int32, int32) bool) *Int32Stream
func (*Int32Stream) Sum ¶
func (s *Int32Stream) Sum() int32
type List ¶
type List[T basic.Object] interface { // 继承 Iterable[T] Remove(index int) T Get(index int) T IsEmpty() bool Size() int AddIndex(index int32, values ...T) List[T] Add(values ...T) List[T] AddAll(values List[T]) List[T] AddAllIndex(index int32, values List[T]) List[T] Contains(value T) bool Clear() ForEach(f func(T)) ToArray() []T Stream() *Stream[T] Iter() Iterator[T] }
type LongStream ¶
type LongStream struct { Head int64 Tail *LongStream Length int NotEmpty bool }
func GenLongStream ¶
func GenLongStream(r *LongStream, f func(*LongStream) int64, m int) *LongStream
func NewLongStream ¶
func NewLongStream(head int64, tail *LongStream) *LongStream
func NullLong ¶
func NullLong() *LongStream
func (*LongStream) Add ¶
func (s *LongStream) Add(i int64) *LongStream
func (*LongStream) Addall ¶
func (s *LongStream) Addall(i ...int64) *LongStream
func (*LongStream) Filter ¶
func (s *LongStream) Filter(f func(int64) bool) *LongStream
func (*LongStream) FoldLeft ¶
func (s *LongStream) FoldLeft(i *LongStream, f func(*LongStream, int64) *LongStream) *LongStream
左折叠 用于实现 reduce 的功能
func (*LongStream) FoldRight ¶
func (s *LongStream) FoldRight(i *LongStream, f func(*LongStream, int64) *LongStream) *LongStream
右折叠
func (*LongStream) Sort ¶
func (s *LongStream) Sort(c func(int64, int64) bool) *LongStream
func (*LongStream) Sum ¶
func (s *LongStream) Sum() int64
type SOffsetT ¶
type SOffsetT int32
A SOffsetT stores a signed offset into arbitrary data.
func GetSOffsetT ¶
GetSOffsetT decodes a little-endian SOffsetT from a byte slice.
type Set ¶
Set defines a thread safe set data structure.
func (*Set[T]) Add ¶
func (s *Set[T]) Add(items ...T)
Add includes the specified items (one or more) to the set. The underlying Set s is modified. If passed nothing it silently returns.
func (*Set[T]) Copy ¶
func (s *Set[T]) Copy() SetInterface[T]
Copy returns a new Set with a copy of s.
func (*Set[T]) Each ¶
Each traverses the items in the Set, calling the provided function for each set member. Traversal will continue until all items in the Set have been visited, or if the closure returns false.
func (*Set[T]) Has ¶
Has looks for the existence of items passed. It returns false if nothing is passed. For multiple items it returns true only if all of the items exist.
func (*Set[T]) IsEqual ¶
func (s *Set[T]) IsEqual(t SetInterface[T]) bool
IsEqual test whether s and t are the same in size and have the same items.
func (*Set[T]) IsSubset ¶
func (s *Set[T]) IsSubset(t SetInterface[T]) (subset bool)
IsSubset tests whether t is a subset of s.
func (*Set) IsSuperset ¶
func (s *Set) IsSuperset(t SetInterface[T]) bool
IsSuperset tests whether t is a superset of s.
func (*Set[T]) List ¶
func (s *Set[T]) List() []T
List returns a slice of all items. There is also StringSlice() and IntSlice() methods for returning slices of type string or int.
func (*Set[T]) Merge ¶
func (s *Set[T]) Merge(t SetInterface[T])
Merge is like Union, however it modifies the current set it's applied on with the given t set.
func (*Set[T]) Pop ¶
func (s *Set[T]) Pop() T
Pop deletes and return an item from the set. The underlying Set s is modified. If set is empty, nil is returned.
func (*Set[T]) Remove ¶
func (s *Set[T]) Remove(items ...T)
Remove deletes the specified items from the set. The underlying Set s is modified. If passed nothing it silently returns.
func (*Set) Separate ¶
func (s *Set) Separate(t SetInterface[T])
it's not the opposite of Merge. Separate removes the set items containing in t from set s. Please aware that
type SetInterface ¶
type SetInterface[T basic.ComObj] interface { Add(items ...T) Remove(items ...T) Pop() T Has(items ...T) bool Size() int Clear() IsEmpty() bool IsEqual(s SetInterface[T]) bool IsSubset(s SetInterface[T]) bool IsSuperset(s SetInterface[T]) bool Each(func(T) bool) String() string List() []T Copy() SetInterface[T] Merge(s SetInterface[T]) Separate(s SetInterface[T]) ForEach(f func(T)) Stream() *Stream[T] }
SetInterface is describing a Set. Sets are an unordered, unique list of values.
func Difference ¶
func Difference[T basic.ComObj](set1, set2 SetInterface[T], sets ...SetInterface[T]) SetInterface[T]
Difference returns a new set which contains items which are in in the first set but not in the others. Unlike the Difference() method you can use this function separately with multiple sets.
func EmptySet ¶
func EmptySet[T basic.ComObj]() SetInterface[T]
func Intersection ¶
func Intersection[T basic.ComObj](set1, set2 SetInterface[T], sets ...SetInterface[T]) SetInterface[T]
Intersection returns a new set which contains items that only exist in all given sets.
func NewSet ¶
func NewSet[T basic.ComObj](settype SetType) SetInterface[T]
New creates and initalizes a new Set interface. Its single parameter denotes the type of set to create. Either ThreadSafe or NonThreadSafe. The default is ThreadSafe.
func NewSetWithItems ¶
func NewSetWithItems[T basic.ComObj](settype SetType, items ...T) SetInterface[T]
func SymmetricDifference ¶
func SymmetricDifference[T basic.ComObj](s SetInterface[T], t SetInterface[T]) SetInterface[T]
SymmetricDifference returns a new set which s is the difference of items which are in one of either, but not in both.
func Union ¶
func Union[T basic.ComObj](set1, set2 SetInterface[T], sets ...SetInterface[T]) SetInterface[T]
Union is the merger of multiple sets. It returns a new set with all the elements present in all the sets that are passed.
The dynamic type of the returned set is determined by the first passed set's implementation of the New() method.
type SetNonTS ¶
SetNonTS defines a non-thread safe set data structure.
func (*SetNonTS) Add ¶
func (s *SetNonTS) Add(items ...T)
Add includes the specified items (one or more) to the set. The underlying Set s is modified. If passed nothing it silently returns.
func (*SetNonTS) Copy ¶
func (s *SetNonTS) Copy() SetInterface[T]
Copy returns a new Set with a copy of s.
func (*SetNonTS) Each ¶
func (s *SetNonTS) Each(f func(item T) bool)
Each traverses the items in the Set, calling the provided function for each set member. Traversal will continue until all items in the Set have been visited, or if the closure returns false.
func (*SetNonTS) Has ¶
func (s *SetNonTS) Has(items ...T) bool
Has looks for the existence of items passed. It returns false if nothing is passed. For multiple items it returns true only if all of the items exist.
func (*SetNonTS) IsEmpty ¶
func (s *SetNonTS) IsEmpty() bool
IsEmpty reports whether the Set is empty.
func (*SetNonTS) IsEqual ¶
func (s *SetNonTS) IsEqual(t SetInterface[T]) bool
IsEqual test whether s and t are the same in size and have the same items.
func (*SetNonTS) IsSubset ¶
func (s *SetNonTS) IsSubset(t SetInterface[T]) (subset bool)
IsSubset tests whether t is a subset of s.
func (*SetNonTS) IsSuperset ¶
func (s *SetNonTS) IsSuperset(t SetInterface[T]) bool
IsSuperset tests whether t is a superset of s.
func (*SetNonTS) List ¶
func (s *SetNonTS) List() []T
List returns a slice of all items. There is also StringSlice() and IntSlice() methods for returning slices of type string or int.
func (*SetNonTS) Merge ¶
func (s *SetNonTS) Merge(t SetInterface[T])
Merge is like Union, however it modifies the current set it's applied on with the given t set.
func (*SetNonTS) Pop ¶
func (s *SetNonTS) Pop() T
Pop deletes and return an item from the set. The underlying Set s is modified. If set is empty, nil is returned.
func (*SetNonTS) Remove ¶
func (s *SetNonTS) Remove(items ...T)
Remove deletes the specified items from the set. The underlying Set s is modified. If passed nothing it silently returns.
func (*SetNonTS) Separate ¶
func (s *SetNonTS) Separate(t SetInterface[T])
it's not the opposite of Merge. Separate removes the set items containing in t from set s. Please aware that
type SetType ¶
type SetType int
SetType denotes which type of set is created. ThreadSafe or NonThreadSafe
type Stream ¶
func NullStream ¶
func (*Stream[T]) MapToInt32 ¶
func (s *Stream[T]) MapToInt32(f func(t T) int32) *Int32Stream
func (*Stream[T]) MapToLong ¶
func (s *Stream[T]) MapToLong(f func(t T) int64) *LongStream
type StringBuilder ¶
type StringBuilder struct {
// contains filtered or unexported fields
}
func NewSB ¶
func NewSB() *StringBuilder
func (*StringBuilder) AddBool ¶
func (b *StringBuilder) AddBool(key string, value bool) *StringBuilder
func (*StringBuilder) AddFloat32 ¶
func (b *StringBuilder) AddFloat32(key string, value float32) *StringBuilder
func (*StringBuilder) AddFloat64 ¶
func (b *StringBuilder) AddFloat64(key string, value float64) *StringBuilder
func (*StringBuilder) AddInt ¶
func (b *StringBuilder) AddInt(key string, value int) *StringBuilder
func (*StringBuilder) AddInt16 ¶
func (b *StringBuilder) AddInt16(key string, value int16) *StringBuilder
func (*StringBuilder) AddInt32 ¶
func (b *StringBuilder) AddInt32(key string, value int32) *StringBuilder
func (*StringBuilder) AddInt64 ¶
func (b *StringBuilder) AddInt64(key string, value int64) *StringBuilder
func (*StringBuilder) AddInt8 ¶
func (b *StringBuilder) AddInt8(key string, value int8) *StringBuilder
func (*StringBuilder) AddString ¶
func (b *StringBuilder) AddString(key string, value string) *StringBuilder
func (*StringBuilder) AddUInt64 ¶
func (b *StringBuilder) AddUInt64(key string, value uint64) *StringBuilder
func (*StringBuilder) AppendBool ¶
func (b *StringBuilder) AppendBool(i bool) *StringBuilder
func (*StringBuilder) AppendChar ¶
func (b *StringBuilder) AppendChar(i byte) *StringBuilder
func (*StringBuilder) AppendFloat32 ¶
func (b *StringBuilder) AppendFloat32(i float32) *StringBuilder
func (*StringBuilder) AppendFloat64 ¶
func (b *StringBuilder) AppendFloat64(i float64) *StringBuilder
func (*StringBuilder) AppendInt ¶
func (b *StringBuilder) AppendInt(i int) *StringBuilder
func (*StringBuilder) AppendInt16 ¶
func (b *StringBuilder) AppendInt16(i int16) *StringBuilder
func (*StringBuilder) AppendInt32 ¶
func (b *StringBuilder) AppendInt32(i int32) *StringBuilder
func (*StringBuilder) AppendInt64 ¶
func (b *StringBuilder) AppendInt64(i int64) *StringBuilder
func (*StringBuilder) AppendInt8 ¶
func (b *StringBuilder) AppendInt8(i int8) *StringBuilder
func (*StringBuilder) AppendString ¶
func (b *StringBuilder) AppendString(i string) *StringBuilder
func (*StringBuilder) AppendUInt32 ¶
func (b *StringBuilder) AppendUInt32(i uint32) *StringBuilder
func (*StringBuilder) AppendUInt64 ¶
func (b *StringBuilder) AppendUInt64(i uint64) *StringBuilder
func (*StringBuilder) Length ¶
func (b *StringBuilder) Length() int
func (*StringBuilder) SetLength ¶
func (b *StringBuilder) SetLength(len int) *StringBuilder
func (*StringBuilder) String ¶
func (b *StringBuilder) String() string
func (*StringBuilder) ToStringHelper ¶
func (b *StringBuilder) ToStringHelper() string
type UOffsetT ¶
type UOffsetT uint32
A UOffsetT stores an unsigned offset into vector data.
func GetUOffsetT ¶
GetUOffsetT decodes a little-endian UOffsetT from a byte slice.