conversion

package
v0.1.0-beta2 Latest Latest
Warning

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

Go to latest
Published: Jun 20, 2018 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Amount

type Amount struct {
	Value uint
}

Amount struct

func (*Amount) Convert

func (amount *Amount) Convert(currency Currency) (value float64)

Convert converts an Amount struct to a specific Currency

func (*Amount) Format

func (amount *Amount) Format(currency Currency) (desc string)

Format returns a nice human readable amount using a given currency

func (*Amount) FromString

func (amount *Amount) FromString(value string) (err error)

FromString converts a string containing a value and an currency unit into the base value

func (*Amount) String

func (amount *Amount) String() (desc string)

String displays the amount using the MESG currency

type Currency

type Currency uint

Currency type definition

const (
	BASE Currency = 1 // base value
	MESG Currency = 1000000000
)

Unit association with number of zero

Jump to

Keyboard shortcuts

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