Documentation ¶
Index ¶
- func AfterDay(date1, date2 time.Time) bool
- func CheckWeekDay(date time.Time) bool
- func CloseHTTPResp(resp *http.Response)
- func Contains(s *[]string, str string) bool
- func ContainsDay(s []time.Time, date time.Time) bool
- func CountDays(dateInit, dateFinal time.Time, business bool) (days int, err error)
- func DownloadResource(filepath, url string) (err error)
- func GetCoinPrice(coin string) (float64, error)
- func GetHolidays(workdays []time.Time, dateInit, dateFinal time.Time) []time.Time
- func GetRequest(url string) ([]byte, int, error)
- func GetTomorrow(date, layout string) string
- func GetYesterday(date, layout string) string
- func Getenv(key, fallback string) string
- func GraphQLGet(url string, query []byte, bearer string) ([]byte, int, error)
- func HTTPRequest(request *http.Request) (body []byte, statusCode int, err error)
- func IsEnvExist(key string) bool
- func MaxString(sl []string) (string, int64)
- func MinString(sl []string) (string, int64)
- func PostRequest(url string, body io.Reader) ([]byte, error)
- func SameDays(date1, date2 time.Time) bool
- func SliceDifference(slice1, slice2 []string) []string
- func StrToUnixtime(s string) (t time.Time, err error)
- func UniqueStrings(s []string) []string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AfterDay ¶
AfterDay returns true if date1 is a date after date2, irrespective of the daytime. The go method "After" respects daytime.
func CheckWeekDay ¶
CheckWeekDay returns true if @date is not weekend and false otherwise.
func CloseHTTPResp ¶ added in v1.2.0
CloseHTTPResp is a wrapper for closing http response bodies while complying with the linter.
func Contains ¶
Contains takes a slice of strings and a string and checks if it is contained in the slice.
func ContainsDay ¶
ContainsDay returns true if day @date is contained in slice @s, independent of the daytime. As a consequence, be cautious when comparing days in different timezones.
func CountDays ¶
CountDays returns the number of days between @dateInit and @dateFinal, both given as converted from a string in the format yyyy-mm-dd, excluding the last day. @bool If true only business days are counted.
func DownloadResource ¶
DownloadResource is a simple utility that downloads a resource from @url and stores it into @filepath.
func GetCoinPrice ¶
GetCoinPrice Gets the price in USD of coin through our API. Looks it up on coingecko in case it doesn't find it there.
func GetHolidays ¶
GetHolidays returns "holidays" as non-weekend complement of given days @workdays
func GetRequest ¶
GetRequest performs a get request on @url and returns the response body as a slice of byte data.
func GetTomorrow ¶
GetTomorrow returns the day before @date in the world of strings, formatted as @layout
func GetYesterday ¶
GetYesterday returns the day before @date in the world of strings, formatted as @layout
func GraphQLGet ¶
GraphQLGet returns the body of the result of a graphQL GET query. @url is the base url of the graphQL API @query is a byte slice representing the graphQL query message @bearer contains the API key if present
func HTTPRequest ¶ added in v1.2.0
HTTPRequest returns the request body and defers the closing compliant to linting.
func IsEnvExist ¶ added in v1.2.0
func PostRequest ¶
PostRequest performs a POST request on @url and returns the response body as a slice of byte data.
func SameDays ¶
SameDays returns true if @date1 is the same date as @date2, independent of the daytime.
func SliceDifference ¶
SliceDifference returns the elements in @slice1 that aren't in @slice2.
func StrToUnixtime ¶
StrToUnixtime converts a string corresponding to an int to Unix time
func UniqueStrings ¶
UniqueStrings returns a subslice of @s such that each entry only appears once
Types ¶
This section is empty.