Documentation
¶
Overview ¶
Package tools provides utility functions for file operations.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrEmptyKey is returned when a key name is empty. ErrEmptyKey = errors.New("key name cannot be empty") // ErrEmptySection is returned when a section name is empty and required. ErrEmptySection = errors.New("section name cannot be empty") // ErrKeyWhitespace is returned when a key has leading/trailing whitespace. ErrKeyWhitespace = errors.New("key name has leading or trailing whitespace") // ErrKeyInvalidChar is returned when a key contains invalid characters. ErrKeyInvalidChar = errors.New("key name contains invalid character") // ErrSectionWhitespace is returned when a section has leading/trailing whitespace. ErrSectionWhitespace = errors.New("section name has leading or trailing whitespace") // ErrSectionInvalidChar is returned when a section contains invalid characters. ErrSectionInvalidChar = errors.New("section name contains invalid character") )
Functions ¶
func AtomicSave ¶ added in v0.5.0
AtomicSave atomically saves an ini.File to the specified path. It writes to a temporary file first, then renames it to prevent corruption.
func IsFileExists ¶
IsFileExists checks if a file exists and is not a directory.
func ValidateKey ¶ added in v0.5.0
ValidateKey validates a key name for INI files. Returns an error if the key is empty or contains invalid characters.
func ValidateSection ¶ added in v0.5.0
ValidateSection validates a section name for INI files. Returns an error if the section contains invalid characters. Empty section is allowed as it represents the default section.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.