Documentation
¶
Index ¶
- Constants
- func BatchGet[T any](ids []string, reqMaker func(string) (T, error)) (out map[string]T)
- func EncodeURIComponent(str string) string
- func EnsureDirOf(path string) error
- func ExpandUserPath(path string) string
- func Filter[T any](items []T, filtfunc func(T) bool) (out []T)
- func FormatDate(t time.Time) string
- func FormatTime(t time.Time) string
- func GetMapField(input StringMap, fieldPath interface{}) (interface{}, error)
- func HTTPErrorCode(err error) int
- func IndexOf[T any](items []T, matchfunc func(T) bool) int
- func Insert[T any](list []T, item T, index int) []T
- func IsDirEmpty(name string) (bool, error)
- func JsonDecodeBytes(bytes []byte) (interface{}, error)
- func JsonDecodeStr(str string) (interface{}, error)
- func JsonGet(url string, onReq func(req *http.Request)) (interface{}, *http.Response, error)
- func JsonReadFile(path string) (interface{}, error)
- func JsonToQueryString(json StringMap) string
- func JsonWriteFile(data interface{}, path string, perm os.FileMode) error
- func Map[T any, U any](items []T, mapfunc func(T) U) (out []U)
- func MapKeys[K comparable, V any](input map[K]V) []K
- func MapValues[V any, K comparable](input map[K]V) []V
- func NeedsRefresh(refresh_type int32, last_refreshed_at time.Time, now time.Time) bool
- func OpenBrowser(url string)
- func ParseDate(str string) time.Time
- func ParseTime(str string) time.Time
- func PriceString(value float64) string
- type DefaultMap
- type HTTPClient
- func (t *HTTPClient) Call(req *http.Request) (response interface{}, err error)
- func (t *HTTPClient) JsonCall(req *http.Request) (response StringMap, err error)
- func (t *HTTPClient) MakeBytesRequest(method string, endpoint string, body []byte) (req *http.Request, err error)
- func (t *HTTPClient) MakeJsonRequest(method string, endpoint string, body StringMap) (req *http.Request, err error)
- func (t *HTTPClient) MakeRequest(method string, endpoint string, bodyReader io.Reader) (req *http.Request, err error)
- func (t *HTTPClient) MakeUrl(endpoint string, args string) (url string)
- type HTTPError
- type StringMap
Constants ¶
View Source
const ( DATE_FORMAT = "2006-01-02" DATETIME_FORMAT = "2006-01-02 03-04-05" )
View Source
const ( ErrCodeInvalidRequest = 400 ErrCodeInvalidCredentials = 401 ErrCodeAuthorized = 403 ErrCodeEntityNotFound = 404 )
Variables ¶
This section is empty.
Functions ¶
func EncodeURIComponent ¶ added in v0.0.14
func EnsureDirOf ¶
func ExpandUserPath ¶
func FormatDate ¶
func FormatTime ¶
func GetMapField ¶ added in v0.0.38
func HTTPErrorCode ¶ added in v0.0.47
func IsDirEmpty ¶
func JsonDecodeBytes ¶
func JsonDecodeStr ¶
func JsonReadFile ¶ added in v0.0.24
func JsonToQueryString ¶
func JsonWriteFile ¶ added in v0.0.24
func MapKeys ¶ added in v0.0.39
func MapKeys[K comparable, V any](input map[K]V) []K
func MapValues ¶ added in v0.0.39
func MapValues[V any, K comparable](input map[K]V) []V
func NeedsRefresh ¶
func OpenBrowser ¶ added in v0.0.4
func OpenBrowser(url string)
*
- Opens the browser pointing to a given URL.
func PriceString ¶
Types ¶
type DefaultMap ¶ added in v0.0.18
type DefaultMap[V interface{}] struct {
// contains filtered or unexported fields
}
func NewDefaultMap ¶ added in v0.0.18
func NewDefaultMap[V any](creator func(key string) V) *DefaultMap[V]
func (*DefaultMap[V]) Ensure ¶ added in v0.0.18
func (tm *DefaultMap[V]) Ensure(key string) V
func (*DefaultMap[V]) Get ¶ added in v0.0.18
func (tm *DefaultMap[V]) Get(key string) (V, bool)
type HTTPClient ¶ added in v0.0.47
func NewClient ¶ added in v0.0.47
func NewClient(host string, apikey string) *HTTPClient
func (*HTTPClient) Call ¶ added in v0.0.47
func (t *HTTPClient) Call(req *http.Request) (response interface{}, err error)
func (*HTTPClient) JsonCall ¶ added in v0.0.47
func (t *HTTPClient) JsonCall(req *http.Request) (response StringMap, err error)
func (*HTTPClient) MakeBytesRequest ¶ added in v0.0.47
func (*HTTPClient) MakeJsonRequest ¶ added in v0.0.47
func (*HTTPClient) MakeRequest ¶ added in v0.0.47
type StringMap ¶
type StringMap = map[string]interface{}
func CopyMapFields ¶ added in v0.0.38
func CopyMapFields(input StringMap, output StringMap, field_paths ...interface{}) (StringMap, error)
*
- Copy a value in a given field path from the source into a fieldpath in the dest if
- a. source field path is valid and exists
- b. dest field path is valid (or needs to be created).
func SetMapField ¶ added in v0.0.38
*
- Sets a map field at a given field path ensuring that everything until the leaf is a dictionary indeed.
func SetMapFields ¶ added in v0.0.38
*
- SetMapFields takes a map and a list of field paths and values and sets the values in the map
- @param input the map to set the values in
- @param field_paths_and_values a list of field paths and values. The field paths are strings separated by "/" and the values are the values to set
- @return error if there is an error at the first fieldpath that failed.
Click to show internal directories.
Click to hide internal directories.