services

package
v0.0.0-...-cda8aca Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 30, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Callback

type Callback func()

type ConcurrentPool

type ConcurrentPool struct {
	// contains filtered or unexported fields
}

ConcurrentPool allows execute a few http requests in parallel, in case all pools is busy request goes to queue

func NewConcurrentPool

func NewConcurrentPool(size int, timeout time.Duration, logger *zap.SugaredLogger) *ConcurrentPool

NewConcurrentPool Creates instance of ConcurrentPool

func (*ConcurrentPool) DefineHeaders

func (s *ConcurrentPool) DefineHeaders(setHeaders SetHeaders)

DefineHeaders defines custom headers to all requests

func (*ConcurrentPool) IsEmptyPool

func (s *ConcurrentPool) IsEmptyPool() bool

IsEmptyPool returns true if no requests in all pools

func (*ConcurrentPool) Request

func (s *ConcurrentPool) Request(req HttpRequest)

Request sends http request get or post

type HttpRequest

type HttpRequest struct {
	Method   string
	Url      string
	Payload  *string
	PoolNum  int // number of pool where it requested
	CallBack ResponseCallback
}

type ResponseCallback

type ResponseCallback func(*http.Response)

type SetHeaders

type SetHeaders func(*http.Request)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL