Documentation ¶
Index ¶
- Constants
- Variables
- func ChangePermission(directory string) error
- func CreateDir(dir string) error
- func EncodeURLValues(urlPath string, values url.Values) string
- func ExtractHost(address string) string
- func ExtractPort(host string) int
- func GetDefaultDataDir(env string) string
- func GetExecutablePath() (string, error)
- func GetURIPath(uri string) string
- func InArray(val, array interface{}) (exists bool, index int)
- func IsEnabled(isEnabled bool) string
- func IsValidCryptoAddress(address, crypto string) (bool, error)
- func NewHTTPClientWithTimeout(t time.Duration) *http.Client
- func OutputCSV(filePath string, data [][]string) error
- func SendHTTPGetRequest(urlPath string, jsonDecode, isVerbose bool, result interface{}) error
- func SendHTTPRequest(method, urlPath string, headers map[string]string, body io.Reader) (string, error)
- func SplitStringSliceByLimit(in []string, limit uint) [][]string
- func StringDataCompare(haystack []string, needle string) bool
- func StringDataCompareInsensitive(haystack []string, needle string) bool
- func StringDataContains(haystack []string, needle string) bool
- func StringDataContainsInsensitive(haystack []string, needle string) bool
- func StringSliceDifference(slice1, slice2 []string) []string
- func YesOrNo(input string) bool
Constants ¶
const ( SatoshisPerBTC = 100000000 SatoshisPerLTC = 100000000 WeiPerEther = 1000000000000000000 )
Const declarations for common.go operations
const SimpleTimeFormat = "2006-01-02 15:04:05"
SimpleTimeFormat a common, but non-implemented time format in golang
Variables ¶
var ( HTTPClient *http.Client HTTPUserAgent string // ErrNotYetImplemented defines a common error across the code base that // alerts of a function that has not been completed or tied into main code ErrNotYetImplemented = errors.New("not yet implemented") // ErrFunctionNotSupported defines a standardised error for an unsupported // wrapper function by an API ErrFunctionNotSupported = errors.New("unsupported wrapper function") )
Vars for common.go operations
Functions ¶
func ChangePermission ¶
ChangePermission lists all the directories and files in an array
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 GetDefaultDataDir ¶
GetDefaultDataDir returns the default data directory Windows - C:\Users\%USER%\AppData\Roaming\GoCryptoTrader Linux/Unix or OSX - $HOME/.gocryptotrader
func GetExecutablePath ¶
GetExecutablePath returns the executables launch path
func GetURIPath ¶
GetURIPath returns the path of a URL given a URI
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 NewHTTPClientWithTimeout ¶
NewHTTPClientWithTimeout initialises a new HTTP client with the specified timeout duration
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, urlPath 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 SplitStringSliceByLimit ¶
SplitStringSliceByLimit splits a slice of strings into slices by input limit and returns a slice of slice of strings
func StringDataCompare ¶
StringDataCompare data checks the substring array with an input and returns a bool
func StringDataCompareInsensitive ¶
StringDataCompareInsensitive data checks the substring array with an input and returns a bool irrespective of lower or upper case strings
func StringDataContains ¶
StringDataContains checks the substring array with an input and returns a bool
func StringDataContainsInsensitive ¶
StringDataContainsInsensitive 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
Types ¶
This section is empty.