Documentation ¶
Index ¶
- func HttpDelete(httpClient IHttpClient, fullURL string, headers map[string]string) (*http.Response, error)
- func HttpDeleteWithContext(ctx context.Context, httpClient IHttpClient, fullURL string, ...) (*http.Response, error)
- func HttpGet(httpClient IHttpClient, fullURL string, headers map[string]string) (*http.Response, error)
- func HttpGetWithContext(ctx context.Context, httpClient IHttpClient, fullURL string, ...) (*http.Response, error)
- func HttpHead(httpClient IHttpClient, fullURL string, headers map[string]string) (*http.Response, error)
- func HttpHeadWithContext(ctx context.Context, httpClient IHttpClient, fullURL string, ...) (*http.Response, error)
- func HttpPost(httpClient IHttpClient, fullURL string, headers map[string]string, body []byte) (*http.Response, error)
- func HttpPostWithContext(ctx context.Context, httpClient IHttpClient, fullURL string, ...) (*http.Response, error)
- func HttpPostWithRetry(httpClient IHttpClient, fullURL string, headers map[string]string, body []byte, ...) (*http.Response, error)
- func HttpRespToString(resp *http.Response) (string, error)
- func JSONDecoder(origin string) *json.Decoder
- func JSONSize(i interface{}) int
- func Split2Chunks[T any](maxNumOfChunks int, slice []T) [][]T
- func SplitSlice2Chunks[T any](slice []T, maxSize int, channelBuffer int) (chunksChannel <-chan []T, sliceSize int)
- type IHttpClient
- type ShouldNotRetryFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func HttpDelete ¶
func HttpDeleteWithContext ¶ added in v0.0.13
func HttpGetWithContext ¶ added in v0.0.13
func HttpHeadWithContext ¶ added in v0.0.13
func HttpPostWithContext ¶ added in v0.0.13
func HttpPostWithRetry ¶ added in v0.0.57
func HttpRespToString ¶
HttpRespToString parses the body as string and checks the HTTP status code, it closes the body reader at the end
func JSONDecoder ¶
JSONDecoder returns JSON decoder for given string
func JSONSize ¶
func JSONSize(i interface{}) int
JSONSize returns the size in bytes of the json encoding of i
func Split2Chunks ¶ added in v0.0.14
func SplitSlice2Chunks ¶
func SplitSlice2Chunks[T any](slice []T, maxSize int, channelBuffer int) (chunksChannel <-chan []T, sliceSize int)
SplitSlice2Chunks - *recursively* splits a slice to chunks of sub slices that do not exceed max bytes size Returns a channels for receiving []T chunks and the original len of []T If []T is empty the function will return a closed chunks channel Chunks might be bigger than max size if the slice contains element(s) that are bigger than the max size this split algorithm fits for slices with elements that share more or less the same size per element uses optimistic average size splitting to enhance performance and reduce the use of json encoding for size calculations chunks channel will be closed after splitting is done