Documentation
¶
Overview ¶
Package utils provides narrowly-scoped helpers shared across packages:
- Filename sanitation (ValidFilename)
- Simple string transforms (Reverse)
- Debug/diagnostic helpers (DebugCurl)
- File cleanup helpers (Clean)
Keep this package small and only for cross-cutting helpers that do not deserve their own domain package.
Index ¶
- func DebugCurl(label, method, url string, headers map[string]string, body any)
- func EscapeSingleQuotes(s string) string
- func GetEnvDuration(key string, defaultValue time.Duration) time.Duration
- func GetEnvFloat(key string, defaultValue float64) float64
- func GetEnvInt(key string, defaultValue int) int
- func GetEnvString(key, defaultValue string) string
- func Reverse(s string) string
- func ValidFilename(in string) string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DebugCurl ¶
DebugCurl prints a reproducible curl command for an outbound OpenAI request when TB_DEBUG_CURL is set. Output is sent directly to stdout (no logger decorations) so it can be copy/pasted. Authorization header is redacted unless TB_DEBUG_CURL_REVEAL_KEY is set.
func EscapeSingleQuotes ¶
func GetEnvDuration ¶
GetEnvDuration returns the environment variable as time.Duration or default if not set/invalid
func GetEnvFloat ¶
GetEnvFloat returns the environment variable as float64 or default if not set/invalid
func GetEnvString ¶
GetEnvString returns the environment variable value or default if not set
func ValidFilename ¶
ValidFilename returns a valid filename from the input string.
Types ¶
This section is empty.