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 ContainedIn[T comparable](xs ...T) func(T) bool
- func DecodeURLData[T any](data string, dst T) error
- func EncodeURLData(data any) (string, 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 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 FirstNonZero[T comparable](opts ...T) (t T)
- func HashString32(s string) uint32
- func HashString64(s string) uint64
- func IsNil[T any](x *T) bool
- func IsNotNil[T any](x *T) bool
- func IsNotZero[T comparable](t T) bool
- func IsZero[T comparable](t T) bool
- func LazyCache[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 MapToMemFS(in map[string][]byte) (fs.FS, error)
- 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 NormalizeURL(rawURL string, secure bool) (string, error)
- 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 TransformToStrings[T any](ts []T) []string
- 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)
- type DoNotCompare
- type DoNotCopy
- type FilterFS
- type IndentedStringWriter
- 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 FilterMapKeys ¶
func FilterMapKeys[K comparable, V any](m map[K]V, f func(K) 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 FirstNonZero ¶ added in v0.9.2
func FirstNonZero[T comparable](opts ...T) (t T)
FirstNonZero returns first opt which is non-zero. If opts is empty, the zero value of T is returned.
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 IsZero ¶ added in v0.3.0
func IsZero[T comparable](t T) bool
func LazyCache ¶ added in v0.10.10
func LazyCache[T, P any](f func(P) T, p P) func() T
LazyCache wraps a function and a single input. The first call to the wrapper calls the wrapped function. Subsequent calls return the first result.
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 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 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 TransformToStrings ¶
func TransformWithIndex ¶
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.
type IndentedStringWriter ¶ added in v0.8.5
type IndentedStringWriter struct { DoNotCopy DoNotCompare W io.Writer Indent string // contains filtered or unexported fields }
func NewIndentedStringWriter ¶ added in v0.8.5
func NewIndentedStringWriter(w io.Writer, indent string) *IndentedStringWriter