utils

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CleanFilePath added in v0.8.21

func CleanFilePath(filePath string) (string, bool)

func GenerateRandomString

func GenerateRandomString(n int) (string, error)

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 RemoveDuplicates added in v0.8.20

func RemoveDuplicates[T comparable](in []T) []T

func SliceInt32ToInt added in v0.8.21

func SliceInt32ToInt(in []int32) (out []int)

func SliceUint64ToInt64 added in v0.8.21

func SliceUint64ToInt64(in []uint64) (out []int64)

func SortInt32Slice

func SortInt32Slice[T constraints.Ordered](x []T)

func StringFirstN added in v0.7.1

func StringFirstN(s string, n int) string

Taken from kAdor here: https://stackoverflow.com/a/41604514

Types

type Comparable added in v0.7.3

type Comparable[T constraints.Ordered] []T

Comparable generic for sorting in increasing order.

func (Comparable[T]) Len added in v0.7.3

func (x Comparable[T]) Len() int

func (Comparable[T]) Less added in v0.7.3

func (x Comparable[T]) Less(i, j int) bool

func (Comparable[T]) Swap added in v0.7.3

func (x Comparable[T]) Swap(i, j int)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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