Documentation ¶
Index ¶
- func IsDir(path string) bool
- func IsFile(path string) bool
- func RandLowerStr(length int) string
- func RandLowerUpperNumStr(length int) string
- func RandNumStr(length int) string
- func RandStr(length int, lower, upper, number bool) string
- func RandUpperStr(length int) string
- func RemoveDuplicates[T comparable](slice []T) []T
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RandLowerStr ¶
func RandLowerUpperNumStr ¶
func RandNumStr ¶
func RandUpperStr ¶
func RemoveDuplicates ¶
func RemoveDuplicates[T comparable](slice []T) []T
RemoveDuplicates removes all duplicate elements from a slice. It returns a new slice with unique elements. The elements of the slice must be comparable. For example, if the slice contains integers, then they must be able to be compared using the "<" operator. If the slice contains structs, then they must have a field that is comparable. For example:
type Person struct { Name string Age int }
If the slice contains pointers to structs, then the pointer's target field must be comparable. For example:
type Person struct { Name string Age int } func (p *Person) Compare(other *Person) bool { return p.Age < other.Age }
In this case, the slice can contain pointers to Person structs, as long as the Age field is comparable.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.