Documentation
¶
Index ¶
- func BuildServerURL(normalizedURL string) string
- func Contains(s, substr string) bool
- func EnsureDir(dirPath string) error
- func EnsureDirWithMode(dirPath string, mode os.FileMode) error
- func FormatDateString(dateString string) (string, error)
- func FormatDateStringWithLocation(dateString string, loc *time.Location) (string, error)
- func FormatTime(t time.Time) string
- func FormatTimeWithLocation(t time.Time, loc *time.Location) string
- func GetARecord(host string) (net.IP, error)
- func GetExternalIP() (net.IP, error)
- func GetTimestampFromDeploymentID(deploymentID string) (time.Time, error)
- func IsValidDomain(domain string) error
- func IsValidEmail(email string) bool
- func NormalizeServerURL(rawURL string) (string, error)
- func NormalizeVersion(version string) string
- func Ptr[T any](v T) *T
- func SafeIDPrefix(id string) string
- func SanitizeString(input string) string
- func ValidatePort(port string) error
- type DebounceFunc
- type Debouncer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuildServerURL ¶
BuildServerURL constructs the full URL for API calls
func EnsureDirWithMode ¶
EnsureDirWithMode creates the directory with custom permissions.
func FormatDateString ¶
FormatDateString formats a date string in a simple, CLI-friendly format similar to Docker and Kubernetes tools (e.g., "2 minutes ago", "3 hours ago", "2 days ago")
func FormatDateStringWithLocation ¶
FormatDateStringWithLocation formats a date string for the specified timezone
func FormatTime ¶
FormatTime formats a time.Time in a simple, CLI-friendly format similar to Docker and Kubernetes tools (e.g., "2 minutes ago", "3 hours ago", "2 days ago")
func FormatTimeWithLocation ¶
FormatTimeWithLocation formats a time.Time for the specified timezone
func GetARecord ¶
GetARecord returns the first A record (IPv4 address) for the provided host. It returns an error if no A record is found.
func GetExternalIP ¶
GetExternalIP queries a public service for this machine's external IPv4. It returns the IP or an error.
func GetTimestampFromDeploymentID ¶
GetTimestampFromDeploymentID extracts time.Time from an ULID
func IsValidDomain ¶
func IsValidEmail ¶
func NormalizeServerURL ¶
NormalizeServerURL strips protocol and normalizes the server URL for storage
func NormalizeVersion ¶
NormalizeVersion strips the 'v' prefix from version strings for comparison
func Ptr ¶
func Ptr[T any](v T) *T
Ptr is a helper that returns a pointer to the given value. Useful for creating pointers to literals or values in a single expression.
func SafeIDPrefix ¶
func SanitizeString ¶
SanitizeString takes a string and sanitizes it for use as a safe identifier. Suitable for HAProxy identifiers (backend names, ACL names), Docker container names, and filenames (when extensions are added separately). Allows alphanumeric characters, hyphens, and underscores. Consecutive disallowed characters are replaced by a single underscore.
func ValidatePort ¶
ValidatePort checks if a port string is a valid port number (1-65535)
Types ¶
type DebounceFunc ¶
type DebounceFunc func()
DebounceFunc defines the type for the function to be executed after debouncing.
type Debouncer ¶
type Debouncer struct {
// contains filtered or unexported fields
}
Debouncer manages debouncing calls for different keys.
func NewDebouncer ¶
NewDebouncer creates a new Debouncer.
func (*Debouncer) Debounce ¶
func (d *Debouncer) Debounce(key string, action DebounceFunc)
Debounce schedules or resets the timer for a given key. When the delay expires without subsequent calls for the same key, the action function is executed.