Documentation ¶
Index ¶
- type Decimal
- func (d Decimal) Add(d2 Decimal) Decimal
- func (d Decimal) Cmp(d2 Decimal) int
- func (d Decimal) Div(d2 Decimal) Decimal
- func (d Decimal) Equal(d2 Decimal) bool
- func (d Decimal) InRange(min, max Decimal) bool
- func (d Decimal) InRangeInt(min, max int64) bool
- func (d *Decimal) IsNegative() bool
- func (d Decimal) IsZero() bool
- func (d Decimal) MarshalText() (text []byte, err error)
- func (d Decimal) Mul(d2 Decimal) Decimal
- func (d Decimal) MulInt(i int64) Decimal
- func (d Decimal) Reduce() Decimal
- func (d Decimal) Round(n int) Decimal
- func (d *Decimal) RoundOrNil(n int) *Decimal
- func (d *Decimal) Scan(src interface{}) error
- func (d Decimal) String() string
- func (d Decimal) Sub(d2 Decimal) Decimal
- func (d *Decimal) UnmarshalJSON(b []byte) error
- func (d *Decimal) UnmarshalText(text []byte) error
- func (d Decimal) Value() (driver.Value, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Decimal ¶
type Decimal struct {
// contains filtered or unexported fields
}
Decimal is an arbitrary-precision decimal.
func MustFromStr ¶
MustFromStr creates a new Decimal from a string. It panics if the string is not a valid decimal.
func (Decimal) InRangeInt ¶
InRangeInt returns true if d is in the range [min, max].
func (Decimal) MarshalText ¶
MarshalText implements encoding.TextMarshaler.
func (*Decimal) RoundOrNil ¶
RoundOrNil returns nil if the Decimal is nil or rounds it to n digits after 0.
func (*Decimal) UnmarshalJSON ¶
UnmarshalJSON implements the json.Unmarshaler interface.
func (*Decimal) UnmarshalText ¶
UnmarshalText implements encoding.TextUnmarshaler.
Click to show internal directories.
Click to hide internal directories.