currency

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2026 License: AGPL-3.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	FreshFor    = 12 * time.Hour
	MaxStale    = 72 * time.Hour
	RetryAfter  = 5 * time.Minute
	BaseCurrent = func() string { return "USD" }
	Fetch       = FetchERAPI
)
View Source
var ErrUnavailable = errors.New("live exchange rate unavailable")
View Source
var Fallback = []string{"USD", "BRL", "EUR", "GBP", "CAD"}

Functions

func CleanStep

func CleanStep(cents int64, cur string) int64

func Convert

func Convert(cents int64, from, to string) (int64, float64, bool)

func ConvertAndFormat

func ConvertAndFormat(cents int64, from, to string) string

func Default

func Default() string

func FetchERAPI

func FetchERAPI(base string) (map[string]float64, error)

func Format

func Format(cents int64, code string) string

func Known

func Known() []string

func Normalize

func Normalize(raw string) string

func Rate

func Rate(from, to string) (float64, bool)

func Refresh

func Refresh() error

func RefreshFor

func RefreshFor(raw string) error

func Reset

func Reset()

func StrictRate

func StrictRate(from, to string) (float64, error)

func Supported

func Supported() []string

Types

This section is empty.

Jump to

Keyboard shortcuts

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