datasource

package
v2.2.1 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DataSource

type DataSource[T any] struct {
	Publisher[T]
	Fetcher         Fetcher[T]
	PollingInterval time.Duration
	Logger          *slog.Logger
	// contains filtered or unexported fields
}

func (*DataSource[T]) GetCurrentAge

func (d *DataSource[T]) GetCurrentAge() time.Time

func (*DataSource[T]) Run

func (d *DataSource[T]) Run(ctx context.Context) error

type Fetcher

type Fetcher[T any] interface {
	GetLastModified(ctx context.Context) (time.Time, error)
	Fetch(ctx context.Context) (T, error)
}

type Publisher

type Publisher[T any] struct {
	// contains filtered or unexported fields
}

func (*Publisher[T]) Publish added in v2.2.0

func (p *Publisher[T]) Publish(value T, currentAge time.Time) bool

func (*Publisher[T]) Register

func (p *Publisher[T]) Register(ch chan T)

func (*Publisher[T]) Unregister

func (p *Publisher[T]) Unregister(ch chan T)

type SciensanoSources

type SciensanoSources struct {
	taskmanager.Manager
	Cases            DataSource[sciensano.Cases]
	Hospitalisations DataSource[sciensano.Hospitalisations]
	Mortalities      DataSource[sciensano.Mortalities]
	TestResults      DataSource[sciensano.TestResults]
	Vaccinations     DataSource[sciensano.Vaccinations]
}

func NewSciensanoDatastore

func NewSciensanoDatastore(url string, pollingInterval time.Duration, httpClient *http.Client, logger *slog.Logger) *SciensanoSources

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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