Documentation ¶
Index ¶
- func GetStacktrace(all bool) string
- func IsSortedAndUnique[T Sortable[T]](s []T) bool
- func IsSortedAndUniqueByHash[T ~[]byte](s []T) bool
- func IsSortedAndUniqueOrdered[T cmp.Ordered](s []T) bool
- func IsSortedBytes[T ~[]byte](s []T) bool
- func Join[T any](slices ...[]T) []T
- func RandomBytes(n int) []byte
- func Sort[T Sortable[T]](s []T)
- func SortByHash[T ~[]byte](s []T)
- func Zero[T any]() T
- func ZeroSlice[T any](s []T)
- type Atomic
- type BytesPool
- type Sortable
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetStacktrace ¶ added in v1.7.17
func IsSortedAndUnique ¶
Returns true iff the elements in [s] are unique and sorted.
func IsSortedAndUniqueByHash ¶ added in v1.9.4
Returns true iff the elements in [s] are unique and sorted based by their hashes.
func IsSortedAndUniqueOrdered ¶ added in v1.9.4
Returns true iff the elements in [s] are unique and sorted.
func IsSortedBytes ¶ added in v1.10.3
Returns true iff the elements in [s] are sorted.
func Join ¶ added in v1.11.11
func Join[T any](slices ...[]T) []T
Join merges the provided slices into a single slice.
TODO: Use slices.Concat once the minimum go version is 1.22.
func RandomBytes ¶ added in v1.3.2
RandomBytes returns a slice of n random bytes Intended for use in testing
func SortByHash ¶ added in v1.9.4
func SortByHash[T ~[]byte](s []T)
Sorts the elements of [s] based on their hashes.
Types ¶
type Atomic ¶ added in v1.9.8
type Atomic[T any] struct { // contains filtered or unexported fields }
func (*Atomic[T]) MarshalJSON ¶ added in v1.11.8
func (*Atomic[T]) UnmarshalJSON ¶ added in v1.11.8
type BytesPool ¶ added in v1.11.4
BytesPool tracks buckets of available buffers to be allocated. Each bucket allocates buffers of the following length:
0 1 3 7 15 31 63 127 ... MaxInt
In order to allocate a buffer of length 19 (for example), we calculate the number of bits required to represent 19 (5). And therefore allocate a slice from bucket 5, which has length 31. This is the bucket which produces the smallest slices that are at least length 19.
When replacing a buffer of length 19, we calculate the number of bits required to represent 20 (5). And therefore place the slice into bucket 4, which has length 15. This is the bucket which produces the largest slices that a length 19 slice can be used for.
func NewBytesPool ¶ added in v1.11.4
func NewBytesPool() *BytesPool
Directories ¶
Path | Synopsis |
---|---|
crypto
|
|
keychain/keychainmock
Package keychainmock is a generated GoMock package.
|
Package keychainmock is a generated GoMock package. |
filesystemmock
Package filesystemmock is a generated GoMock package.
|
Package filesystemmock is a generated GoMock package. |
hashingmock
Package hashingmock is a generated GoMock package.
|
Package hashingmock is a generated GoMock package. |
iteratormock
Package iteratormock is a generated GoMock package.
|
Package iteratormock is a generated GoMock package. |
resourcemock
Package resourcemock is a generated GoMock package.
|
Package resourcemock is a generated GoMock package. |