fetcher

package
v0.0.0-...-eee2b2e Latest Latest
Warning

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

Go to latest
Published: Jul 9, 2020 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidInputData    = errors.New("invalid input data")
	ErrCreatingHTTPRequest = errors.New("error creating HTTP request")
	ErrWrongHTTPMethod     = errors.New("wrong HTTP method")
)

Functions

This section is empty.

Types

type Fetcher

type Fetcher interface {
	// Fetch data from external resource.
	Fetch(ID string, data *model.FetchData) (*model.Response, error)
}

Fetcher interface for external resource.

func NewHTTPFetcher

func NewHTTPFetcher(timeout time.Duration) Fetcher

NewHTTPFetcher constructor.

func NewMockFetcher

func NewMockFetcher() Fetcher

NewMockFetcher constructor.

type HTTPFetcher

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

HTTPFetcher for external resource implements Fetcher interface.

func (*HTTPFetcher) Fetch

func (f *HTTPFetcher) Fetch(id string, data *model.FetchData) (*model.Response, error)

Fetch data from external resource.

type MockFetcher

type MockFetcher struct{}

func (*MockFetcher) Fetch

func (f *MockFetcher) Fetch(id string, data *model.FetchData) (*model.Response, error)

Fetch data from mock resource.

Jump to

Keyboard shortcuts

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