Documentation
¶
Overview ¶
Package fx fetches the ECB euro reference rates through the host, persists the last good snapshot and converts it to USD-based display rates. USD stays the only stored and computed unit; these rates are display-only.
Index ¶
Constants ¶
View Source
const MaxBytes = 1 << 20
MaxBytes caps the fetched ECB document.
View Source
const Timeout = 30 * time.Second
Timeout bounds one fetch.
Variables ¶
This section is empty.
Functions ¶
func ParseECB ¶
ParseECB decodes the ECB daily reference rates document. It returns the reference date and the rates per 1 EUR. Anything but exactly one dated cube with valid, unique currency codes and positive rates including USD is an error, so shape drift fails closed.
Types ¶
type State ¶
type State struct {
Snapshot *store.FXSnapshot // nil until a document was loaded
Error string // last fetch error ("" = last attempt ok)
}
State is the published FX state.
type Worker ¶
type Worker struct {
// contains filtered or unexported fields
}
Worker owns the ECB fetch lifecycle.
Click to show internal directories.
Click to hide internal directories.