Module Utility

Module Utility 

Source
Expand description

Common utility functions

These utilities provide defensive helper functions used throughout the Air library for validation, ID generation, timestamp handling, and common operations with proper error handling.

Functionsยง

CalculateBackoffDelay
Calculate exponential backoff delay
CurrentTimestamp
Get current timestamp in milliseconds since UNIX epoch
CurrentTimestampSeconds
Get current timestamp in seconds since UNIX epoch
FormatBytes
Format bytes as human-readable size
GenerateRequestId
Generate a unique request ID
GenerateRequestIdWithPrefix
Generate a unique request ID with a prefix
ParseDurationToMillis
Parse duration string to milliseconds
SanitizeForLogging
Sanitize a string for logging
TimestampToISO8601
Convert timestamp millis to ISO 8601 string
ValidateFilePath
Validate file path security
ValidatePort
Validate port number
ValidateStringLength
Validate string length
ValidateUrl
Validate URL format