fetch

package
v0.0.0-...-18492a3 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2022 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Fetcher

type Fetcher interface {
	Fetch(url string) (io.ReadCloser, error)
}

Fetcher download data from source

func NewFetcher

func NewFetcher() Fetcher

NewFetcher create new Fetcher

func NewMock

func NewMock() Fetcher

NewMock create new Mock

type Mock

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

Mock emulates fetcher behaviour

func (*Mock) Fetch

func (f *Mock) Fetch(url string) (io.ReadCloser, error)

Fetch waits specified time and return result if presented

func (*Mock) SetData

func (f *Mock) SetData(url string, data []byte)

SetData add data that will be fetched by url

func (*Mock) SetDelay

func (f *Mock) SetDelay(url string, minTime time.Duration, maxTime time.Duration)

SetDelay setup delay for fetching data from url

type SimpleFetcher

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

SimpleFetcher download data from source and checks content type

func (SimpleFetcher) Fetch

func (f SimpleFetcher) Fetch(url string) (io.ReadCloser, error)

Fetch retrieve data from url

Jump to

Keyboard shortcuts

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