Documentation ¶
Index ¶
- Variables
- func AmountToFloat64(amount uint64, decimals uint8) float64
- func AmountToString(amount uint64, decimals uint8) string
- func AmountToUint64(amount float64, decimals uint8) uint64
- func AnyToString(v interface{}) string
- func Base58ToBytes(s string) ([]byte, error)
- func Base64ToBytes(s string) ([]byte, error)
- func BytesToBase58(b []byte) string
- func BytesToBase64(b []byte) string
- func DownloadFile(url string) ([]byte, error)
- func Float64ToString(amount float64) string
- func GetFileByPath(path string) ([]byte, error)
- func GetFileTypeByURI(uri string) string
- func GetVarType(v interface{}) string
- func IntAmountToFloat64(amount int64, decimals uint8) float64
- 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 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 AmountToFloat64 ¶
AmountToFloat64 converts amount lamports to float64 with given decimals.
func AmountToString ¶
AmountToString converts amount lamports to string with given decimals.
func AmountToUint64 ¶
AmountToUint64 converts amount from float64 to uint64 with given decimals.
func Base58ToBytes ¶
Base58ToBytes converts base58 string to bytes.
func Base64ToBytes ¶
Base64ToBytes converts base64 string to bytes.
func BytesToBase58 ¶
BytesToBase58 converts bytes to base58 string.
func BytesToBase64 ¶
BytesToBase64 converts bytes to base64 string.
func DownloadFile ¶
DownloadFile downloads the file from the given URL and returns the bytes.
func Float64ToString ¶
Float64ToString converts float64 to string with minimum number of decimals. For example, 1.000000000 will be converted to "1", 1.100000000 will be converted to "1.1".
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 IntAmountToFloat64 ¶
IntAmountToFloat64 converts int64 amount lamports to float64 with given decimals.
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.