Documentation
¶
Index ¶
- Variables
- func AnsiStrip(str string) string
- func CalcPermutation(n, r int) int
- func CalcPermutationMore(n, r1, r2 int) int
- func CheckPort(port int) error
- func ContainsItems[T comparable](s1 []T, s2 []T) bool
- func Dedupe[T comparable](inputSlice []T) (result []T)
- func GeneratePassword(password string) string
- func GenerateToken(token, username string) (string, error)
- func GetHeaderToken(authorization string) (token string, err error)
- func Intersection[T comparable](s1, s2 []T) []T
- func ParseAddr(addr string) (string, int, error)
- func ParseHost(host string) (ips []string)
- func ParsePort(portStr string) (ports []int)
- func ParseURLToHostAndURI(u string) (string, string, error)
- func PickRandom[T any](v []T) T
- func PruneEmptyStrings(v []string) []string
- func PruneEqual[T comparable](inputSlice []T, equalTo T) (r []T)
- func RandomString() string
- func RandomStringByLength(n int, allowedChars ...[]rune) string
- func RefreshToken(tokenString string) (string, error)
- func SliceContains[T comparable](inputSlice []T, element T) bool
- func SliceToInt(s []string) ([]int, error)
- func VerifyPassword(hash, password string) bool
- type Claims
- type OncePlus
Constants ¶
This section is empty.
Variables ¶
View Source
var (
ErrHost = fmt.Errorf("cannot parse host")
)
Error
Functions ¶
func CalcPermutation ¶
func CalcPermutationMore ¶
func ContainsItems ¶
func ContainsItems[T comparable](s1 []T, s2 []T) bool
ContainsItems checks if s1 contains s2
func Dedupe ¶
func Dedupe[T comparable](inputSlice []T) (result []T)
Dedupe removes duplicates from a slice of elements preserving the order
func GeneratePassword ¶
GeneratePassword - Generate bcrypt hash password
func GenerateToken ¶
GenerateToken generate tokens used for auth
func GetHeaderToken ¶
func Intersection ¶
func Intersection[T comparable](s1, s2 []T) []T
func ParseURLToHostAndURI ¶
ParseURLToHostAndURI [http/s://]domain/ip[:port]/uri -> host,uri,err
func PruneEmptyStrings ¶
PruneEmptyStrings from the slice
func PruneEqual ¶
func PruneEqual[T comparable](inputSlice []T, equalTo T) (r []T)
PruneEqual removes items from the slice equal to the specified value
func RandomStringByLength ¶
RandomStringByLength 随机字符串
func SliceContains ¶
func SliceContains[T comparable](inputSlice []T, element T) bool
SliceContains if a slice contains an element
func SliceToInt ¶
ToInt converts a slice of strings to a slice of ints
func VerifyPassword ¶
VerifyPassword - Verify bcrypt hash password
Types ¶
Source Files
¶
Click to show internal directories.
Click to hide internal directories.