fetcher

package
v1.12.1 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2022 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 Cacher

type Cacher struct {
	Fetcher
	// contains filtered or unexported fields
}

func NewCacher

func NewCacher(f Fetcher) *Cacher

func (*Cacher) AutoUpdate added in v1.12.1

func (c *Cacher) AutoUpdate(ctx context.Context, interval time.Duration)

func (*Cacher) Fetch

func (c *Cacher) Fetch(ctx context.Context, dataType int) ([]apiclient.APIResponse, error)

type Fetcher

type Fetcher interface {
	Fetch(ctx context.Context, dataType int) ([]apiclient.APIResponse, error)
	GetLastUpdated(ctx context.Context, dataType int) (time.Time, error)
	DataTypes() map[int]string
}

Fetcher retrieves data from an API

type Limiter

type Limiter struct {
	Fetcher
	// contains filtered or unexported fields
}

func NewLimiter

func NewLimiter(fetcher Fetcher, maxParallel int64) *Limiter

func (*Limiter) Fetch

func (l *Limiter) Fetch(ctx context.Context, dataType int) (results []apiclient.APIResponse, err error)

func (*Limiter) GetLastUpdated added in v1.12.1

func (l *Limiter) GetLastUpdated(ctx context.Context, dataType int) (lastUpdated time.Time, err error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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