Documentation
¶
Index ¶
- Variables
- func AddQueryParam(u, k string, v interface{}) string
- func AddQueryParams(u string, params map[string]interface{}) string
- func AnyToString(v interface{}) string
- func DownloadFile(url string) ([]byte, error)
- func GetFileByPath(path string) ([]byte, error)
- func GetFileTypeByURI(uri string) string
- func GetVarType(v interface{}) string
- func ParseFileSize(s string) (int64, error)
- func Pointer[T any](v T) *T
- func PrettyPrint(v ...interface{})
- func PrettyString(v interface{}) string
- func SanitizeEmail(s string) (string, error)
- func StructToUrlValues(v interface{}) (url.Values, error)
- func ToSnakeCase(s string) string
- func TrimRightZeros(str string) string
- func TrimStringBetween(str, start, end string) string
- func UcFirst(s string) string
Constants ¶
This section is empty.
Variables ¶
var ( ErrInvalidEmailAddress = errors.New("invalid email address") ErrInvalidIcanSuffix = errors.New("invalid ICAN suffix") )
Functions ¶
func AddQueryParam ¶
AddQueryParam adds a query parameter to a URL.
func AddQueryParams ¶
AddQueryParams adds query parameters to a URL.
func DownloadFile ¶
DownloadFile downloads the file from the given URL and returns the bytes.
func GetFileByPath ¶
GetFileByPath returns the file bytes from the given path. If the path is a URL, it will download the file and return the bytes. If the path is a local file, it will read the file and return the bytes.
func GetFileTypeByURI ¶
GetFileTypeByURI returns the file type of the given URI
func GetVarType ¶
func GetVarType(v interface{}) string
GetVarType returns the type of the given variable as a string.
func ParseFileSize ¶
Parse file size from string to int64
func Pointer ¶
func Pointer[T any](v T) *T
Pointer is a helper to make a pointer to the given value.
func PrettyPrint ¶
func PrettyPrint(v ...interface{})
PrettyPrint prints the given interface in a pretty format
func PrettyString ¶
func PrettyString(v interface{}) string
PrettyString returns the given interface in a pretty format
func SanitizeEmail ¶
SanitizeEmail cleans email address from dots, dashes, etc
func StructToUrlValues ¶
StructToUrlValues converts a struct to a url.Values object.
func TrimRightZeros ¶
TrimRightZeros trims trailing zeros from string.
func TrimStringBetween ¶
Trim string between two substrings and return the string without it and substrings.
Types ¶
This section is empty.