Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( DefaultSliceCheck float64 = 0.20 DefaultSliceAlloc float64 = 2.00 )
View Source
var ( // Delay is used to set variable time delays for testing purposes. Delay int = 1e3 )
Functions ¶
func RandomString ¶
func RandomlyTimedString ¶
Types ¶
type GetSetter ¶
type GetSetter[K constraints.Ordered, V any] interface { Get(key K) (value V, ok bool) Set(key K, value V) error }
type KVLister ¶
type KVLister[K constraints.Ordered, V any] interface { Keys() []K Values() []V }
type Slc ¶
type Slc[T any] []T // sorted in alphabetical order ...
func CheckSize ¶
CheckSize accepts a pointer to a slice and checks to see if the len of a slice is within 20% of the capacity of the slice and reallocates if necessary.
If the capacity is still sufficient, it returns the initial pointer unchanged.
If the capacity is insufficient, it allocates a new slice, sets the old slice equal to the new slice, and returns a pointer to the new slice.
The default 20% warning and 200% allocation can be overridden by setting the config variables DefaultSliceCheck and DefaultSliceAlloc, respectively.
Click to show internal directories.
Click to hide internal directories.