currency

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Oct 3, 2025 License: MIT Imports: 0 Imported by: 0

Documentation

Overview

Package currency provides a currency conversion interface and implementation.

Index

Constants

View Source
const ISOCurrencyUSD = "USD"

ISOCurrencyUSD is the ISO-4217 currency code for USD.

Variables

This section is empty.

Functions

func DoConversion

func DoConversion(
	converter Converter,
	baseCurrency any,
	quoteCurrency string,
	baseValue any,
) (any, error)

DoConversion is a helper, that can be used in column implementations to quickly convert a value stored in other columns

Types

type Converter

type Converter interface {
	Convert(isoBaseCurrency string, isoQuoteCurrency string, amount float64) (float64, error)
}

Converter is an interface that converts currency amounts between different ISO currencies.

func NewDummyConverter

func NewDummyConverter(factor float64) Converter

NewDummyConverter creates a new dummy currency converter.

Jump to

Keyboard shortcuts

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