utils

package
v6.7.0 Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2025 License: GPL-3.0 Imports: 7 Imported by: 0

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

Constants

This section is empty.

Variables

This section is empty.

Functions

func DebugCurl

func DebugCurl(label, method, url string, headers map[string]string, body any)

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 EscapeSingleQuotes(s string) string

func GetEnvDuration

func GetEnvDuration(key string, defaultValue time.Duration) time.Duration

GetEnvDuration returns the environment variable as time.Duration or default if not set/invalid

func GetEnvFloat

func GetEnvFloat(key string, defaultValue float64) float64

GetEnvFloat returns the environment variable as float64 or default if not set/invalid

func GetEnvInt

func GetEnvInt(key string, defaultValue int) int

GetEnvInt returns the environment variable as int or default if not set/invalid

func GetEnvString

func GetEnvString(key, defaultValue string) string

GetEnvString returns the environment variable value or default if not set

func Reverse

func Reverse(s string) string

Reverse returns the reverse of the input string.

func ValidFilename

func ValidFilename(in string) string

ValidFilename returns a valid filename from the input string.

Types

This section is empty.

Jump to

Keyboard shortcuts

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