strings

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: May 17, 2026 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func TrimIfEnabled

func TrimIfEnabled(trimEnabled bool, field TrimmableField, changes SanitizationResult) bool

TrimIfEnabled conditionally trims a field if trimEnabled is true Returns true if the value was changed, false otherwise.

func TrimMultipleFields

func TrimMultipleFields(trimEnabled bool, fields []TrimmableField, changes SanitizationResult) int

TrimMultipleFields trims multiple fields with the same configuration Returns the count of fields that were actually changed.

func TrimWhitespaceField

func TrimWhitespaceField(field TrimmableField, changes SanitizationResult) bool

TrimWhitespaceField trims whitespace from a string field and tracks changes Returns true if the value was changed, false otherwise.

Types

type SanitizationResult

type SanitizationResult interface {
	AddChange(path string, original, newValue any, reason string)
}

SanitizationResult interface for change tracking.

type TrimmableField

type TrimmableField struct {
	Name     string  // Field name for identification
	Value    *string // Pointer to string value to modify
	Path     string  // Full path for change tracking
	Original string  // Original value (if needed separately)
}

TrimmableField represents a string field that can be trimmed.

type TrimmableFieldsBuilder

type TrimmableFieldsBuilder struct {
	// contains filtered or unexported fields
}

TrimmableFieldsBuilder helps build trimmable field configurations.

func NewTrimmableFieldsBuilder

func NewTrimmableFieldsBuilder() *TrimmableFieldsBuilder

NewTrimmableFieldsBuilder creates a new builder for trimmable fields.

func (*TrimmableFieldsBuilder) AddField

func (b *TrimmableFieldsBuilder) AddField(
	name, path string,
	value *string,
) *TrimmableFieldsBuilder

AddField adds a trimmable field to the builder.

func (*TrimmableFieldsBuilder) Build

Build returns the configured trimmable fields.

Jump to

Keyboard shortcuts

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