Documentation
¶
Index ¶
- Variables
- func RandInt(min, max int) int
- func RandIntN(n int) int
- type Decimal
- func ChgPct(a, b Decimal) Decimal
- func ChgPctN(a, b Decimal, places int32) Decimal
- func Mean(nums ...Decimal) Decimal
- func NewFromFloat(value float64) Decimal
- func NewFromInt(value int64) Decimal
- func NewFromString(value string) (Decimal, error)
- func Pct(a, b Decimal) Decimal
- func PctN(a, b Decimal, places int32) Decimal
- func Sum(nums ...Decimal) Decimal
- func (d Decimal) Abs() Decimal
- func (d Decimal) Add(other Decimal) Decimal
- func (d Decimal) Cmp(other Decimal) int
- func (d Decimal) Div(other Decimal) Decimal
- func (d Decimal) DivSafe(other Decimal) (Decimal, error)
- func (d Decimal) Equal(other Decimal) bool
- func (d Decimal) Float64() float64
- func (d Decimal) GreaterThan(other Decimal) bool
- func (d Decimal) IntPart() int64
- func (d Decimal) IsNegative() bool
- func (d Decimal) IsPositive() bool
- func (d Decimal) IsZero() bool
- func (d Decimal) LessThan(other Decimal) bool
- func (d Decimal) Mul(other Decimal) Decimal
- func (d Decimal) Neg() Decimal
- func (d Decimal) Precision() int
- func (d Decimal) Round(places int32) Decimal
- func (d Decimal) String() string
- func (d Decimal) Sub(other Decimal) Decimal
- func (d Decimal) Truncate(places int32) Decimal
- func (d Decimal) Value() decimal.Decimal
Constants ¶
This section is empty.
Variables ¶
View Source
var ( Zero = Decimal{/* contains filtered or unexported fields */} One = Decimal{/* contains filtered or unexported fields */} )
常量定义
Functions ¶
Types ¶
type Decimal ¶
type Decimal struct {
// contains filtered or unexported fields
}
Decimal 封装了 shopspring/decimal 库的 Decimal 类型,提供更易用的接口
func NewFromString ¶
NewFromString 从字符串创建一个 Decimal 对象
Click to show internal directories.
Click to hide internal directories.