Documentation ¶
Index ¶
- type CAD
- func (c CAD) Abs() CAD
- func (c CAD) Add(other CAD) CAD
- func (c CAD) AsCents() int64
- func (c CAD) CanonicalForm() (dollars int64, cents int64)
- func (c CAD) GoString() string
- func (c CAD) MarshalJSON() (b []byte, err error)
- func (c CAD) Mul(scalar int64) CAD
- func (c *CAD) Scan(value interface{}) (err error)
- func (c CAD) String() string
- func (c CAD) Sub(other CAD) CAD
- func (c *CAD) UnmarshalJSON(b []byte) (err error)
- func (c CAD) Value() (driver.Value, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CAD ¶
type CAD struct {
// contains filtered or unexported fields
}
func ParseCAD ¶
ParseCAD parses the string ‘s’ and return the equivalent CAD.
If ‘s’ does not contain a money amount, then ParseCAD returns an error.
Some example valid strings include:
• -$1234.56 • $-1234.56 • -$1,234.56 • $-1,234.56 • CAD -$1234.56 • CAD $-1234.56 • CAD-$1,234.56 • CAD$-1,234.56 • $1234.56 • $1,234.56 • CAD $1234.56 • CAD $1,234.56 • CAD$1234.56 • CAD$1,234.56 • $0.09 • $.09 • -$0.09 • -$.09 • $-0.09 • $-.09 • CAD $0.09 • CAD $.09 • CAD -$0.09 • CAD -$.09 • CAD $-0.09 • CAD $-.09 • CAD$0.09 • CAD$.09 • CAD-$0.09 • CAD-$.09 • CAD$-0.09 • CAD$-.09 • 9¢ • -9¢ • 123456¢ • -123456¢
func (CAD) CanonicalForm ¶
CanonicalForm returns the number of dollars and cents that CAD represents.
‘cents’ is always less than for equal to 99. I.e.,:
cents ≤ 99