stringutils

package
v1.9.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 8, 2025 License: GPL-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultNormalizer = NewDefaultNormalizer()

DefaultNormalizer is a statically allocated default normalizer for strings.

Functions

This section is empty.

Types

type Normalizer

type Normalizer[K comparable, V any] struct {
	// contains filtered or unexported fields
}

Normalizer caches transformed results so we do not repeatedly transform the same inputs.

func NewDefaultNormalizer

func NewDefaultNormalizer() *Normalizer[string, string]

NewDefaultNormalizer returns a normalizer using the default TTL and default transform (ToLower + TrimSpace).

func NewNormalizer

func NewNormalizer[K comparable, V any](ttl time.Duration, transform TransformFunc[K, V]) *Normalizer[K, V]

NewNormalizer returns a normalizer with the provided TTL and transform function for cached entries.

func (*Normalizer[K, V]) Clear

func (n *Normalizer[K, V]) Clear(key K)

Clear removes a cached entry.

func (*Normalizer[K, V]) Normalize

func (n *Normalizer[K, V]) Normalize(key K) V

Normalize returns the transformed value.

type TransformFunc

type TransformFunc[K, V any] func(K) V

TransformFunc is a function that transforms K to V.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL