Documentation ¶
Index ¶
- Variables
- func All(tasks ...func())
- func Await[T any, V any, A ~[]T](task func(T) V, args *A) []V
- func AwaitWith[T any, V any, A ~[]T, R ~[]V](task func(T) V, args *A, results *R)
- func Clean(original string) string
- func Contains[S ~[]E, E comparable](s S, v E) bool
- func ContainsFunc[S ~[]E, E any](s S, f func(E) bool) bool
- func Equal[S ~[]E, E comparable](s1, s2 S) bool
- func FileNotExists(path string) bool
- func Index[S ~[]E, E comparable](s S, v E) int
- func IndexFunc[S ~[]E, E any](s S, f func(E) bool) int
- func Insert[S ~[]E, E any](s S, i int, v ...E) S
- func Intn(n int) int
- func Keys[M ~map[K]V, K comparable, V any](m M) []K
- func List(task func(i int), length int)
- func RandomLetter(n int) []rune
- func RandomNumber(digit int) int
- func RandomNumberMixString(digit, mix int) string
- func RandomString(digit int) string
- func Retry(times, delay int, f func() bool)
- func RetryError(times, delay int, f func() error)
- func RetryWith[T any](times, delay int, f func(T) bool, arg T)
- func SimilarText(first, second string) float64
- func Ternary[T any](expr bool, a, b T) T
- func Timer(uids ...string) gin.H
- type EventLoop
- type Time
Constants ¶
This section is empty.
Variables ¶
Functions ¶
func Contains ¶ added in v0.2.1
func Contains[S ~[]E, E comparable](s S, v E) bool
Contains reports whether v is present in s.
func ContainsFunc ¶ added in v0.1.1
ContainsFunc reports whether at least one element e of s satisfies f(e).
func Equal ¶ added in v0.1.1
func Equal[S ~[]E, E comparable](s1, s2 S) bool
Equal reports whether two slices are equal: the same length and all elements equal. If the lengths are different, Equal returns false. Otherwise, the elements are compared in increasing index order, and the comparison stops at the first unequal pair. Floating point NaNs are not considered equal.
func FileNotExists ¶
func Index ¶ added in v0.2.1
func Index[S ~[]E, E comparable](s S, v E) int
Index returns the index of the first occurrence of v in s, or -1 if not present.
func IndexFunc ¶ added in v0.1.1
IndexFunc returns the first index i satisfying f(s[i]), or -1 if none do.
func Insert ¶ added in v0.1.1
Insert inserts the values v... into s at index i, returning the modified slice. The elements at s[i:] are shifted up to make room. In the returned slice r, r[i] == v[0], and r[i+len(v)] == value originally at r[i]. Insert panics if i is out of range. This function is O(len(s) + len(v)).
func Keys ¶ added in v0.1.1
func Keys[M ~map[K]V, K comparable, V any](m M) []K
Keys returns the keys of the map m. The keys will be in an indeterminate order.
func RandomLetter ¶
随机字母