currency

package
v0.0.0-...-d8d7dd1 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2024 License: BSD-3-Clause Imports: 4 Imported by: 0

Documentation

Overview

Package currency provides a fixed-precision representation of an amount of currency as an integer count of millicents.

Index

Constants

View Source
const (
	Millicents = 1
	Cents      = 1000 * Millicents
	Dollars    = 100 * Cents
)

The units of currency.

Variables

This section is empty.

Functions

This section is empty.

Types

type Value

type Value int64

Value represents a currency value

func ParseUSD

func ParseUSD(s string) (Value, error)

ParseUSD parses a string denoting a value in US dollars to a Value.

func (Value) String

func (c Value) String() string

String renders c as a value in millicents.

func (Value) USD

func (c Value) USD() string

USD renders c as a value in U.S. dollars ($ddd.cc).

Jump to

Keyboard shortcuts

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