Documentation
¶
Index ¶
- func AbsInt(x int) int
- func FormatDuration(seconds float64) string
- func GetRandomImagePathFromPath(folderPath string) (string, error)
- func InferProtocolByPort(hostname string, port int) string
- func ReadFileToBase64(filePath string) (string, error)
- func SanitizeString(input string) string
- func TrimString(input string, limit int) string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AbsInt ¶
AbsInt returns the absolute value of an integer.
x: the input integer int: the absolute value of the input integer
func FormatDuration ¶
FormatDuration formats the given duration in seconds into a string in the format "hh:mm:ss".
seconds float64 - the duration in seconds to be formatted string - the formatted duration string
func GetRandomImagePathFromPath ¶
GetRandomImagePathFromPath returns a random image path from the given folder path.
It takes a folderPath string as a parameter and returns a string and an error.
func InferProtocolByPort ¶
InferProtocolByPort is a function that infers the protocol based on the hostname and port.
It takes a hostname of type string and a port of type int as parameters, and returns a string.
func ReadFileToBase64 ¶
ReadFileToBase64 reads the content of the file at the given filePath and returns it as a base64 encoded string.
Parameter: filePath string - the path to the file to be read. Return: string - the base64 encoded content of the file. error - an error if any operation fails.
func SanitizeString ¶
SanitizeString sanitizes the input string by removing non-printable unicode characters.
It takes a string input and returns a sanitized string.
func TrimString ¶
TrimString trims the input string to the specified limit.
It takes a string input and an integer limit as parameters and returns a string.
Types ¶
This section is empty.