Documentation
¶
Overview ¶
Package util provides environment variable parsing helpers shared across components.
Package util provides utility functions for the PromptPipe application.
Index ¶
- func GenerateParticipantID() string
- func GenerateRandomAlphaNumeric(length int) string
- func GenerateRandomHex(length int) string
- func GenerateRandomID(prefix string, hexLength int) string
- func GenerateResponseID() string
- func GetEnvWithDefault(key, defaultValue string) string
- func ParseBoolEnv(key string, defaultValue bool) bool
- func ParseFloatEnv(key string, defaultValue float64) float64
- func ParseIntEnv(key string, defaultValue int) int
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GenerateParticipantID ¶
func GenerateParticipantID() string
GenerateParticipantID generates a unique participant ID with "p_" prefix.
func GenerateRandomAlphaNumeric ¶
GenerateRandomAlphaNumeric generates a random alphanumeric string of the specified length. Uses math/rand/v2 for optimal performance and modern best practices.
func GenerateRandomHex ¶
GenerateRandomHex generates a random hexadecimal string of the specified length. Uses math/rand/v2 with optimal entropy utilization for non-cryptographic purposes.
func GenerateRandomID ¶
GenerateRandomID generates a random ID with the specified prefix and hex length. The returned ID will be in the format: "{prefix}{hex_string}". Uses math/rand/v2 for optimal performance with modern best practices.
func GenerateResponseID ¶
func GenerateResponseID() string
GenerateResponseID generates a unique response ID with "r_" prefix.
func GetEnvWithDefault ¶
GetEnvWithDefault returns the environment variable or a default if unset/empty.
func ParseBoolEnv ¶
ParseBoolEnv parses a boolean environment variable with a default value. Accepts: true/1/yes/on and false/0/no/off (case-insensitive). Invalid values return default.
func ParseFloatEnv ¶
ParseFloatEnv parses a float environment variable with a default fallback. For temperature-like values (0.0-1.0) caller should validate range if needed.
func ParseIntEnv ¶
ParseIntEnv parses an integer environment variable with a default fallback.
Types ¶
This section is empty.