Documentation
¶
Index ¶
- func Conform(v interface{}) error
- func Normalize(value string, opts NormalizeOptions) string
- func ParseDynamicType(input string) any
- func ParseQueryString(query string) (map[string][]string, error)
- func RgxGroup(names ...string) string
- func StringOrEmpty(ptr *string) string
- type NormalizeOption
- type NormalizeOptions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Conform ¶ added in v0.1.335
func Conform(v interface{}) error
Conform is a wrapper for conform.Strings.
func Normalize ¶
func Normalize(value string, opts NormalizeOptions) string
Normalize processes a string based on the given options.
func ParseDynamicType ¶
ParseDynamicType attempts to convert a string into the most appropriate type. The original string is returned if no conversion is possible.
func ParseQueryString ¶
ParseQueryString parses a URL query string into a key-value map.
func StringOrEmpty ¶
StringOrEmpty safely dereferences a string pointer, returning an empty string if nil.
Types ¶
type NormalizeOption ¶
type NormalizeOption func(*NormalizeOptions)
func WithRemoveDiacritics ¶
func WithRemoveDiacritics() NormalizeOption
WithRemoveDiacritics removes diacritics.
func WithRemoveDigits ¶
func WithRemoveDigits() NormalizeOption
WithRemoveDigits removes numeric digits.
func WithRemoveNonASCII ¶
func WithRemoveNonASCII() NormalizeOption
WithRemoveNonASCII removes non-ASCII characters.
func WithRemovePunctuation ¶
func WithRemovePunctuation() NormalizeOption
WithRemovePunctuation removes punctuation.
func WithRemoveSymbols ¶
func WithRemoveSymbols() NormalizeOption
WithRemoveSymbols removes special symbols.
func WithTrimSpace ¶
func WithTrimSpace() NormalizeOption
WithTrimSpace trims leading and trailing spaces.
type NormalizeOptions ¶
type NormalizeOptions struct {
ToLower bool
RemoveDiacs bool
TrimSpace bool
RemovePunct bool
RemoveSpec bool
RemoveDigits bool
RemoveNonASCII bool
}
func ApplyNormalizeOptions ¶
func ApplyNormalizeOptions(opts *NormalizeOptions, modifiers ...NormalizeOption) NormalizeOptions
ApplyNormalizeOptions applies functional options to NormalizeOptions.