Documentation
¶
Index ¶
- Variables
- type Decimal
- func (d Decimal) Abs() Decimal
- func (d Decimal) Add(e Decimal) Decimal
- func (d Decimal) AddString(s string) Decimal
- func (d Decimal) AppendBinary(data []byte) ([]byte, error)
- func (d Decimal) AppendText(text []byte) ([]byte, error)
- func (d Decimal) Ceil() Decimal
- func (d Decimal) Div(e Decimal) Decimal
- func (d Decimal) Equal(e Decimal) bool
- func (d Decimal) Float64() float64
- func (d Decimal) Floor() Decimal
- func (d Decimal) Greater(e Decimal) bool
- func (d Decimal) GreaterEqual(e Decimal) bool
- func (d Decimal) IntPart() int64
- func (d Decimal) IsNeg() bool
- func (d Decimal) IsPositive() bool
- func (d Decimal) IsZero() bool
- func (d Decimal) Less(e Decimal) bool
- func (d Decimal) LessEqual(e Decimal) bool
- func (d Decimal) MarshalBSONValue() (typ byte, data []byte, err error)
- func (d Decimal) MarshalBinary() ([]byte, error)
- func (d Decimal) MarshalJSON() ([]byte, error)
- func (d Decimal) MarshalText() ([]byte, error)
- func (d Decimal) Mul(e Decimal) Decimal
- func (d Decimal) MulFloat001() Decimal
- func (d Decimal) Neg() Decimal
- func (d Decimal) Round(scale int) Decimal
- func (d *Decimal) Scan(value any) error
- func (d Decimal) String() string
- func (d Decimal) StringFixed(pointStatCoinsPoint int) string
- func (d Decimal) Sub(e Decimal) Decimal
- func (d Decimal) Truncate() Decimal
- func (d *Decimal) UnmarshalBSONValue(typ byte, data []byte) error
- func (d *Decimal) UnmarshalBinary(data []byte) error
- func (d *Decimal) UnmarshalJSON(data []byte) error
- func (d *Decimal) UnmarshalText(text []byte) error
- func (d Decimal) Value() (driver.Value, error)
Constants ¶
This section is empty.
Variables ¶
View Source
var Float001 = Decimal{/* contains filtered or unexported fields */}
View Source
var One = Decimal{/* contains filtered or unexported fields */}
View Source
var Two = Decimal{/* contains filtered or unexported fields */}
View Source
var Zero = Decimal{/* contains filtered or unexported fields */}
Functions ¶
This section is empty.
Types ¶
type Decimal ¶
type Decimal struct {
// contains filtered or unexported fields
}
在govalues.Decimal的基础上包装一层,用于减少error类型的返回
func NewFromFloat64 ¶
func NewFromInt ¶
func NewFromInt32 ¶
func NewFromInt64 ¶
func NewFromString ¶
func (Decimal) IsPositive ¶
IsPositive 是否正数 true if d > 0 false otherwise
func (Decimal) MarshalBSONValue ¶
func (Decimal) MarshalBinary ¶
func (Decimal) MarshalJSON ¶
func (Decimal) MarshalText ¶
func (Decimal) MulFloat001 ¶
func (Decimal) StringFixed ¶
StringFixed 四舍五入
Example:
NewFromFloat(0).StringFixed(2) // output: "0.00" NewFromFloat(0).StringFixed(0) // output: "0" NewFromFloat(5.45).StringFixed(0) // output: "5" NewFromFloat(5.45).StringFixed(1) // output: "5.5" NewFromFloat(5.45).StringFixed(2) // output: "5.45" NewFromFloat(5.45).StringFixed(3) // output: "5.450" NewFromFloat(545).StringFixed(-1) // output: "550"
func (*Decimal) UnmarshalBSONValue ¶
func (*Decimal) UnmarshalBinary ¶
func (*Decimal) UnmarshalJSON ¶
func (*Decimal) UnmarshalText ¶
Click to show internal directories.
Click to hide internal directories.