Documentation ¶
Index ¶
- func CleanFilePath(filePath string) (string, bool)
- func GenerateRandomString(n int) (string, error)
- func ParseCookies(cookie string) ([]*http.Cookie, error)
- func RemoveSliceDuplicates[T comparable](in []T) []T
- func SliceInt32ToInt(in []int32) (out []int)
- func SliceUint64ToInt64(in []uint64) (out []int64)
- func SlicesDifference[T comparable](a, b []T) ([]T, []T)
- func SlicesDifferenceFunc[T comparable](a, b []T, keyFn func(in T) string) ([]T, []T)
- func SortInt32Slice[T constraints.Ordered](x []T)
- func StringFirstN(s string, n int) string
- type Comparable
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CleanFilePath ¶
func GenerateRandomString ¶
Taken from https://gist.github.com/dopey/c69559607800d2f2f90b1b1ed4e550fb GenerateRandomString returns a securely generated random string. It will return an error if the system's secure random number generator fails to function correctly, in which case the caller should not continue.
func RemoveSliceDuplicates ¶
func RemoveSliceDuplicates[T comparable](in []T) []T
func SliceInt32ToInt ¶
func SliceUint64ToInt64 ¶
func SlicesDifference ¶
func SlicesDifference[T comparable](a, b []T) ([]T, []T)
SlicesDifference duplicates of values are ignored
func SlicesDifferenceFunc ¶
func SlicesDifferenceFunc[T comparable](a, b []T, keyFn func(in T) string) ([]T, []T)
func SortInt32Slice ¶
func SortInt32Slice[T constraints.Ordered](x []T)
func StringFirstN ¶
Taken from kAdor here: https://stackoverflow.com/a/41604514
Types ¶
type Comparable ¶
type Comparable[T constraints.Ordered] []T
Comparable generic for sorting in increasing order.
func (Comparable[T]) Len ¶
func (x Comparable[T]) Len() int
func (Comparable[T]) Less ¶
func (x Comparable[T]) Less(i, j int) bool
func (Comparable[T]) Swap ¶
func (x Comparable[T]) Swap(i, j int)
Source Files ¶
Click to show internal directories.
Click to hide internal directories.