Monetary amount
A monetary amount is a quantity of money represented by a numeric value together with a currency.
Learn Go with Pocket-Sized Projects
An amount is a monetary value whose numeric representation is interpreted with a currency and subject to supported precision constraints.
- How it is used
- Represents the quantity-and-currency input and output of a command-line currency converter.
- How deep it goes
- Works through representation, construction, conversion, validation, and tests, while retaining explicit supported-range limitations.
- Examples
- Uses 19.8875 Canadian dollars as an invalid amount and conversion tests covering target precision, large values, and small rates.
- What you can do after
- Build it from scratch as a validated Go Amount type and test its construction and conversion boundaries.
Read how Learn Go with Pocket-Sized Projects explains monetary amount →
Building User-Friendly DSLs
A DSL type whose values represent monetary amounts.
- How it is used
- Enables rental-price attributes and expressions to represent dollar values distinctly from percentages and date ranges.
- How deep it goes
- Works through bottom-up expression typing on ASTs, including references, binary operations, parentheses, and an untyped fallback.
- Examples
- Uses a discounted rental-price expression with amount references, a percentage discount, of, and subtraction.
- What you can do after
- Evaluate/understand whether rental-price expressions compute to an amount and why invalid type combinations require errors.
Read how Building User-Friendly DSLs explains monetary amount →
Related concepts
- Stringerimplements · fmt.Stringer is a Go standard-library interface implemented by a type with a parameterless String method returning a textual representation.
- account balanceincludes · An account balance is the recorded amount of money or funds associated with a financial account.
- BigDecimalused by · BigDecimal is a Java standard-library class representing immutable, arbitrary-precision signed decimal values.
- currencyhas part · Currency is a system and unit of money used to express monetary value, facilitate exchange, and denominate financial amounts.
- fraud detectionused by · Fraud detection is the process of identifying transactions, activities, or other events suspected of involving intentional deception or unauthorized gain.
These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.

