Categorygithub.com/dmitrymomot/go-utils
modulepackage
0.1.6
Repository: https://github.com/dmitrymomot/go-utils.git
Documentation: pkg.go.dev

# README

go-utils

Go helpers and utilities. See GoDoc for more details.

GitHub tag (latest SemVer) Tests CodeQL Analysis GolangCI Lint Go Report Card Go Reference License

# Functions

AmountToFloat64 converts amount lamports to float64 with given decimals.
AmountToString converts amount lamports to string with given decimals.
AmountToUint64 converts amount from float64 to uint64 with given decimals.
AnyToString converts any type to string.
Base58ToBytes converts base58 string to bytes.
Base64ToBytes converts base64 string to bytes.
BytesToBase58 converts bytes to base58 string.
BytesToBase64 converts bytes to base64 string.
Capitalize capitalizes all words in a string.
DownloadFile downloads the file from the given URL and returns the bytes.
Float64ToString converts float64 to string with minimum number of decimals.
FullyQualifiedStructName name returns object name in format [package].[type name].
GetFileByPath returns the file bytes from the given path.
GetFileContentType returns the content type of a file.
GetFileContentTypeByBytes returns the content type of a file.
Get the file name without extension.
Get the file size.
GetFileTypeByURI returns the file type of the given URI.
Get max file parts can be if the file is split into parts with the given part size.
GetVarType returns the type of the given variable as a string.
IntAmountToFloat64 converts int64 amount lamports to float64 with given decimals.
is response accepted as audio?.
is response accepted as css?.
Is request a form request?.
is response accepted as html?.
is response accepted as image?.
is response accepted as javascript?.
Is request a json request?.
is response accepted as json?.
Is request a multipart request?.
Is request a text request?.
is response accepted as text?.
is response accepted as video?.
Is request a xml request?.
is response accepted as xml?.
MapToStruct maps a map to a struct.
MergeIntoMap merges `src` map into `dst` map.
MergeIntoMapRecursively recursively merges `src` map into `dst` map.
NamedStruct returns the name from a message implementing the following interface: type namedStruct interface { Name() string } It ignores if the value is a pointer or not.
NewContextWithCancel returns a new context with a cancel function.
Parse file size from string to int64.
Pointer is a helper to make a pointer to the given value.
PrettyPrint prints the given interface in a pretty format.
PrettyString returns the given interface in a pretty format.
SanitizeEmail cleans email address from dots, dashes, etc.
StructName name returns struct name in format [type name].
StructToMap converts a struct to a map.
ToSnakeCase converts string to snake case.
ToTitleCase converts string to title case.
TrimRightZeros trims trailing zeros from string.
Trim string between two substrings and return the string without it and substrings.
UcFirst capitalizes first letter of a string.

# Variables

Predefined errors.
No description provided by the author
No description provided by the author
Predefined errors.
Predefined errors.