resource

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2023 License: GPL-3.0 Imports: 13 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[V any] struct {
	UpdatedAt *time.Time

	OnUpdate func(V)
	// contains filtered or unexported fields
}

func NewFetcher

func NewFetcher[V any](name string, interval time.Duration, vehicle types.Vehicle, parser Parser[V], onUpdate func(V)) *Fetcher[V]

func (*Fetcher[V]) Destroy

func (f *Fetcher[V]) Destroy() error

func (*Fetcher[V]) Initial

func (f *Fetcher[V]) Initial() (V, error)

func (*Fetcher[V]) Name

func (f *Fetcher[V]) Name() string

func (*Fetcher[V]) Update

func (f *Fetcher[V]) Update() (V, bool, error)

func (*Fetcher[V]) Vehicle

func (f *Fetcher[V]) Vehicle() types.Vehicle

func (*Fetcher[V]) VehicleType

func (f *Fetcher[V]) VehicleType() types.VehicleType

type FileVehicle

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

func NewFileVehicle

func NewFileVehicle(path string) *FileVehicle

func (*FileVehicle) Path

func (f *FileVehicle) Path() string

func (*FileVehicle) Read

func (f *FileVehicle) Read() ([]byte, error)

func (*FileVehicle) Type

func (f *FileVehicle) Type() types.VehicleType

type HTTPVehicle

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

func NewHTTPVehicle

func NewHTTPVehicle(url string, path string) *HTTPVehicle

func (*HTTPVehicle) Path

func (h *HTTPVehicle) Path() string

func (*HTTPVehicle) Read

func (h *HTTPVehicle) Read() ([]byte, error)

func (*HTTPVehicle) Type

func (h *HTTPVehicle) Type() types.VehicleType

func (*HTTPVehicle) Url

func (h *HTTPVehicle) Url() string

type Parser

type Parser[V any] func([]byte) (V, error)

Jump to

Keyboard shortcuts

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