Documentation
¶
Index ¶
- func AbsDiffInt(x, y int) int
- func AbsDiffUint(x, y uint) uint
- func AbsInt(x int) int
- func FormatDuration(seconds float64) string
- func GetRandomImagePathFromPath(folderPath string) (string, error)
- func GetWeightedRandomImagePath(folderPath string) (string, error)
- func InferProtocolByPort(hostname string, port int) string
- func IsYouTubeURL(url string) bool
- func Min(a, b int) int
- func ParseFloat64(s string) (float64, error)
- func ParseInt(s string) (int, error)
- func ParseInt64(s string) (int64, error)
- 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 AbsDiffInt ¶
absDiffInt calculates the absolute difference between two integers.
x, y are the integers to find the absolute difference between. int is the return type, representing the absolute difference.
func AbsDiffUint ¶
absDiffUint calculates the absolute difference between two unsigned integers.
x, y uint uint
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 GetWeightedRandomImagePath ¶
GetWeightedRandomImagePath returns a random image path with reduced chances for recently shown images.
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 IsYouTubeURL ¶
func Min ¶
min returns the minimum of two integers.
Parameters:
a int - the first integer b int - the second integer
Return type:
int - the minimum of the two integers
func ParseFloat64 ¶
parseFloat64 parses the input string as a 64-bit floating point number.
It takes a string as input and returns a float64 and an error.
func ParseInt ¶
parseInt parses the input string to an integer.
It takes a string as input and returns an integer and an error.
func ParseInt64 ¶
parseInt64 parses the input string into a 64-bit signed integer.
It takes a string as a parameter and returns a 64-bit signed integer and an error.
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.