Documentation ¶
Overview ¶
Taken from https://github.com/egtann/strip-wildcard-prefix/blob/main/strip_wildcard.go. See discussion in https://github.com/golang/go/issues/64909.
Index ¶
- func All(xs ...bool) bool
- func Any(xs ...bool) bool
- func ContainedIn[T comparable](xs ...T) func(T) bool
- func DecodeURLData[T any](data string, dst T) error
- func EncodeURLData(data any) (string, error)
- func ErrorWithPrefix[T any](prefix T, err error) error
- func FSToMap(in fs.FS) (map[string][]byte, error)
- func Filter[T any](ts []T, f func(T) bool) []T
- func FilterMapKeys[K comparable, V any](m map[K]V, f func(K) bool) map[K]V
- func FilterMapValues[K comparable, V any](m map[K]V, f func(V) bool) map[K]V
- func FilterNils[T any](ts []*T) []*T
- func FilterZeroes[T comparable](ts []T) []T
- func FindFirst[T any](vs []T, f func(T) bool) (int, T)
- func FirstError(errs []error) error
- func FoldLeft[X, A any](xs []X, f func(a A, x X) A, a A) A
- func HashString32(s string) uint32
- func HashString64(s string) uint64
- func Head[T any](xs []T) (t T)
- func IsNil[T any](x *T) bool
- func IsNotNil[T any](x *T) bool
- func IsNotZero[T comparable](t T) bool
- func IsUnique[X any, Y comparable](xs []X, f func(X) Y) bool
- func IsZero[T comparable](t T) bool
- func Lazy1[T, P any](f func(P) T, p P) func() T
- func ListToMap[T any, K comparable, V any](ts []T, f func(T) (K, V)) map[K]V
- func ListToMapError[T any, K comparable, V any](ts []T, f func(T) (K, V, error)) (map[K]V, error)
- func MapFilter[K comparable, V any](m map[K]V, f func(K, V) bool) map[K]V
- func MapToMemFS(in map[string][]byte) (fs.FS, error)
- func MapValuesSortedByKeys[A cmp.Ordered, B any](m map[A]B) []B
- func MarshalProtoMapJSON[K comparable, V proto.Message](xs map[K]V) ([]byte, error)
- func MarshalProtoSliceJSON[T proto.Message](xs []T) ([]byte, error)
- func MatchLongestSuffix(s string, suffixes []string) string
- func Must0(err error)
- func Must1[A any](a A, err error) A
- func Must11[A, X any](f func(A) (X, error)) func(A) X
- func Must12[A, X, Y any](f func(A) (X, Y, error)) func(A) (X, Y)
- func Must2[A, B any](a A, b B, err error) (A, B)
- func MustEqual[T comparable](a, b T, msg ...any)
- func NewFilter[T any](f func(T) bool) func([]T) []T
- func NewMapFilter[K comparable, V any](f func(K, V) bool) func(map[K]V) map[K]V
- func NewMapKeysFilter[K comparable, V any](f func(K) bool) func(map[K]V) map[K]V
- func NewMapValuesFilter[K comparable, V any](f func(V) bool) func(map[K]V) map[K]V
- func NormalizeURL(rawURL string, secure bool) (string, error)
- func PadLeft(s string, r rune, n int) string
- func Panic(msg any)
- func SetPanicFunc(f func(any))
- func Should1[T any](alt T) func(t T, err error) T
- func Should11[X, Y any](alt Y, f func(X) (Y, error)) func(X) Y
- func ShouldFunc1[T any](alt func(error) T) func(t T, err error) T
- func ShouldFunc11[X, Y any](alt func(error) Y, f func(X) (Y, error)) func(X) Y
- func StripWildcardPrefix(prefix string, h http.Handler) http.Handler
- func ToString[T any](t T) string
- func Transform[A, B any](as []A, f func(A) B) []B
- func TransformError[A, B any](as []A, f func(A) (B, error)) ([]B, error)
- func TransformFilter[A, B any](as []A, f func(A) *B) []B
- func TransformMap[A0, A1 comparable, B0, B1 any](m map[A0]B0, f func(A0, B0) (A1, B1)) map[A1]B1
- func TransformMapError[A0, A1 comparable, B0, B1 any](m map[A0]B0, f func(A0, B0) (A1, B1, error)) (map[A1]B1, error)
- func TransformMapToList[K comparable, V, T any](m map[K]V, f func(K, V) T) []T
- func TransformMapToListError[K comparable, V, T any](m map[K]V, f func(K, V) (T, error)) ([]T, error)
- func TransformMapValues[A comparable, B0, B1 any](m map[A]B0, f func(B0) B1) map[A]B1
- func TransformMapValuesError[A comparable, B0, B1 any](m map[A]B0, f func(B0) (B1, error)) (map[A]B1, error)
- func TransformPtr[T any](in []T) (out []*T)
- func TransformToStrings[T any](ts []T) []string
- func TransformUnptr[T any](in []*T) (out []T)
- func TransformWithIndex[A, B any](as []A, f func(int, A) B) []B
- func TxtarToFS(a *txtar.Archive) (fs.FS, error)
- func ValidateList[T any](vs []T, f func(int, T) error) (int, error)
- func ValidateMap[K comparable, V any](m map[K]V, f func(K, V) error) error
- type DoNotCompare
- type DoNotCopy
- type FilterFS
- type String
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ContainedIn ¶
func ContainedIn[T comparable](xs ...T) func(T) bool
func DecodeURLData ¶ added in v0.5.0
func EncodeURLData ¶ added in v0.5.0
func ErrorWithPrefix ¶ added in v0.3.0
func FilterMapKeys ¶
func FilterMapKeys[K comparable, V any](m map[K]V, f func(K) bool) map[K]V
func FilterMapValues ¶
func FilterMapValues[K comparable, V any](m map[K]V, f func(V) bool) map[K]V
func FilterNils ¶
func FilterNils[T any](ts []*T) []*T
func FilterZeroes ¶ added in v0.3.0
func FilterZeroes[T comparable](ts []T) []T
func FirstError ¶
func HashString32 ¶
HashString32 computes the 32-bit FNV-1a hash of s in software. maphash.String does only 64bit version. (in Alan I trust: https://github.com/google/starlark-go/blob/f86470692795f8abcf9f837a3c53cf031c5a3d7e/starlark/hashtable.go#L435)
func HashString64 ¶
func IsNotZero ¶ added in v0.3.0
func IsNotZero[T comparable](t T) bool
func IsUnique ¶
func IsUnique[X any, Y comparable](xs []X, f func(X) Y) bool
func IsZero ¶ added in v0.3.0
func IsZero[T comparable](t T) bool
func ListToMap ¶
func ListToMap[T any, K comparable, V any](ts []T, f func(T) (K, V)) map[K]V
This does not guard against duplicate keys.
func ListToMapError ¶
func ListToMapError[T any, K comparable, V any](ts []T, f func(T) (K, V, error)) (map[K]V, error)
func MapFilter ¶
func MapFilter[K comparable, V any](m map[K]V, f func(K, V) bool) map[K]V
func MapValuesSortedByKeys ¶
MapValuesSortedByKeys returns a slice of the map's values in stable order.
func MarshalProtoMapJSON ¶ added in v0.6.0
func MarshalProtoMapJSON[K comparable, V proto.Message](xs map[K]V) ([]byte, error)
func MarshalProtoSliceJSON ¶ added in v0.6.0
func MatchLongestSuffix ¶
func MustEqual ¶
func MustEqual[T comparable](a, b T, msg ...any)
func NewMapFilter ¶
func NewMapFilter[K comparable, V any](f func(K, V) bool) func(map[K]V) map[K]V
func NewMapKeysFilter ¶
func NewMapKeysFilter[K comparable, V any](f func(K) bool) func(map[K]V) map[K]V
func NewMapValuesFilter ¶
func NewMapValuesFilter[K comparable, V any](f func(V) bool) func(map[K]V) map[K]V
func NormalizeURL ¶ added in v0.4.0
NormalizeURL ensures that the given URL has the right scheme prefix, and no suffix (e.g. path) after the host address.
func SetPanicFunc ¶
func SetPanicFunc(f func(any))
func ShouldFunc1 ¶
func ShouldFunc11 ¶
Same as Should1s, but alt is lazy.
func StripWildcardPrefix ¶ added in v0.4.4
func TransformError ¶
func TransformFilter ¶ added in v0.6.0
func TransformFilter[A, B any](as []A, f func(A) *B) []B
func TransformMap ¶
func TransformMap[A0, A1 comparable, B0, B1 any](m map[A0]B0, f func(A0, B0) (A1, B1)) map[A1]B1
func TransformMapError ¶
func TransformMapError[A0, A1 comparable, B0, B1 any](m map[A0]B0, f func(A0, B0) (A1, B1, error)) (map[A1]B1, error)
func TransformMapToList ¶
func TransformMapToList[K comparable, V, T any](m map[K]V, f func(K, V) T) []T
func TransformMapToListError ¶
func TransformMapToListError[K comparable, V, T any](m map[K]V, f func(K, V) (T, error)) ([]T, error)
func TransformMapValues ¶
func TransformMapValues[A comparable, B0, B1 any](m map[A]B0, f func(B0) B1) map[A]B1
func TransformMapValuesError ¶
func TransformMapValuesError[A comparable, B0, B1 any](m map[A]B0, f func(B0) (B1, error)) (map[A]B1, error)
func TransformPtr ¶
func TransformPtr[T any](in []T) (out []*T)
func TransformToStrings ¶
func TransformUnptr ¶
func TransformUnptr[T any](in []*T) (out []T)
func TransformWithIndex ¶
func ValidateList ¶
Returns first index with error.
func ValidateMap ¶
func ValidateMap[K comparable, V any](m map[K]V, f func(K, V) error) error
Types ¶
type DoNotCompare ¶ added in v0.3.0
type DoNotCompare [0]func()
type FilterFS ¶ added in v0.7.1
type FilterFS struct { fs.FS // embed underlying FS Pred func(fs.DirEntry) bool // DirEntry predicate }
FilterFS will filter entries based on a predicate function.
func NewFilterFS ¶ added in v0.7.1
NewFilterFS returns a new FilterFS wrapping the given FS and predicate. `nil` pred assumes to always return true.