Documentation ¶
Index ¶
- Constants
- func Base64Decode(input string) ([]byte, error)
- func Base64Encode(input []byte) string
- func CalculateAmountWithFee(amount, fee float64) float64
- func CalculateFee(amount, fee float64) float64
- func CalculateNetProfit(amount, priceThen, priceNow, costs float64) float64
- func CalculatePercentageDifference(amount, secondAmount float64) float64
- func CalculatePercentageGainOrLoss(priceNow, priceThen float64) float64
- func EncodeURLValues(url string, values url.Values) string
- func ExtractHost(address string) string
- func ExtractPort(host string) int
- func GetExecutablePath() (string, error)
- func GetHMAC(hashType int, input, key []byte) []byte
- func GetMD5(input []byte) []byte
- func GetOSPathSlash() string
- func GetSHA256(input []byte) []byte
- func GetSHA512(input []byte) []byte
- func GetURIPath(uri string) string
- func HexEncodeToString(input []byte) string
- func IsEnabled(isEnabled bool) string
- func IsValidCryptoAddress(address, crypto string) (bool, error)
- func JSONDecode(data []byte, to interface{}) error
- func JSONEncode(v interface{}) ([]byte, error)
- func JoinStrings(input []string, separator string) string
- func OutputCSV(path string, data [][]string) error
- func ReadFile(path string) ([]byte, error)
- func RemoveFile(file string) error
- func ReplaceString(input, old, new string, n int) string
- func RoundFloat(x float64, prec int) float64
- func SendHTTPGetRequest(url string, jsonDecode, isVerbose bool, result interface{}) error
- func SendHTTPRequest(method, path string, headers map[string]string, body io.Reader) (string, error)
- func SplitStrings(input, separator string) []string
- func StringContains(input, substring string) bool
- func StringDataCompare(haystack []string, needle string) bool
- func StringDataContains(haystack []string, needle string) bool
- func StringDataContainsUpper(haystack []string, needle string) bool
- func StringSliceDifference(slice1 []string, slice2 []string) []string
- func StringToLower(input string) string
- func StringToUpper(input string) string
- func TrimString(input, cutset string) string
- func UnixTimestampStrToTime(timeStr string) (time.Time, error)
- func UnixTimestampToTime(timeint64 int64) time.Time
- func WriteFile(file string, data []byte) error
- func YesOrNo(input string) bool
Constants ¶
const ( HashSHA1 = iota HashSHA256 HashSHA512 HashSHA512_384 SatoshisPerBTC = 100000000 SatoshisPerLTC = 100000000 WeiPerEther = 1000000000000000000 )
Const declarations for common.go operations
Variables ¶
This section is empty.
Functions ¶
func Base64Decode ¶
Base64Decode takes in a Base64 string and returns a byte array and an error
func Base64Encode ¶
Base64Encode takes in a byte array then returns an encoded base64 string
func CalculateAmountWithFee ¶
CalculateAmountWithFee returns a calculated fee included amount on fee
func CalculateFee ¶
CalculateFee returns a simple fee on amount
func CalculateNetProfit ¶
CalculateNetProfit returns net profit
func CalculatePercentageDifference ¶
CalculatePercentageDifference returns the percentage of difference between multiple time periods
func CalculatePercentageGainOrLoss ¶
CalculatePercentageGainOrLoss returns the percentage rise over a certain period
func EncodeURLValues ¶
EncodeURLValues concatenates url values onto a url string and returns a string
func ExtractHost ¶
ExtractHost returns the hostname out of a string
func ExtractPort ¶
ExtractPort returns the port name out of a string
func GetExecutablePath ¶
GetExecutablePath returns the executables launch path
func GetOSPathSlash ¶
func GetOSPathSlash() string
GetOSPathSlash returns the slash used by the operating systems file system
func GetURIPath ¶
GetURIPath returns the path of a URL given a URI
func HexEncodeToString ¶
HexEncodeToString takes in a hexadecimal byte array and returns a string
func IsEnabled ¶
IsEnabled takes in a boolean param and returns a string if it is enabled or disabled
func IsValidCryptoAddress ¶
IsValidCryptoAddress validates your cryptocurrency address string using the regexp package // Validation issues occurring because "3" is contained in litecoin and Bitcoin addresses - non-fatal
func JSONDecode ¶
JSONDecode decodes JSON data into a structure
func JSONEncode ¶
JSONEncode encodes structure data into JSON
func JoinStrings ¶
JoinStrings joins an array together with the required separator and returns it as a string
func ReplaceString ¶
ReplaceString replaces a string with another
func RoundFloat ¶
RoundFloat rounds your floating point number to the desired decimal place
func SendHTTPGetRequest ¶
SendHTTPGetRequest sends a simple get request using a url string & JSON decodes the response into a struct pointer you have supplied. Returns an error on failure.
func SendHTTPRequest ¶
func SendHTTPRequest(method, path string, headers map[string]string, body io.Reader) (string, error)
SendHTTPRequest sends a request using the http package and returns a response as a string and an error
func SplitStrings ¶
SplitStrings splits blocks of strings from string into a string array using a separator ie "," or "_"
func StringContains ¶
StringContains checks a substring if it contains your input then returns a bool
func StringDataCompare ¶
StringDataCompare data checks the substring array with an input and returns a bool
func StringDataContains ¶
StringDataContains checks the substring array with an input and returns a bool
func StringDataContainsUpper ¶
StringDataContainsUpper checks the substring array with an input and returns a bool irrespective of lower or upper case strings
func StringSliceDifference ¶
StringSliceDifference concatenates slices together based on its index and returns an individual string array
func StringToLower ¶
StringToLower changes strings to lowercase
func StringToUpper ¶
StringToUpper changes strings to uppercase
func TrimString ¶
TrimString trims unwanted prefixes or postfixes
func UnixTimestampStrToTime ¶
UnixTimestampStrToTime returns a time.time and an error
func UnixTimestampToTime ¶
UnixTimestampToTime returns time.time
Types ¶
This section is empty.