fetcher

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Jan 5, 2026 License: MIT Imports: 11 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package fetcher implements a service that periodically fetches club load data.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Club

type Club struct {
	Title       string `json:"title"`
	CurrentLoad string `json:"currentLoad"` //nolint:tagliatelle
	ID          int    `json:"id"`
}

Club represents the JSON structure of the club data returned by the API.

type Fetcher

type Fetcher struct {
	Db           *databaser.DB
	Client       *http.Client
	URL          string
	Token        string
	Timeout      time.Duration
	QueryTimeout time.Duration
}

Fetcher struct holds the configuration for the fetcher.

func (*Fetcher) Fetch

func (f *Fetcher) Fetch(ctx context.Context, eventCh chan<- databaser.Event) error

Fetch retrieves the current load and saves it to the database.

func (*Fetcher) Run

func (f *Fetcher) Run(ctx context.Context) (<-chan struct{}, <-chan databaser.Event, error)

Run begins the periodic fetching process.

Jump to

Keyboard shortcuts

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