Documentation ¶
Index ¶
- Constants
- Variables
- func Compare(x, y Value) int
- func Equal(x, y Value) bool
- func Parse(input string) (num int64, numDecimalPoints int, err error)
- type RoundingMode
- type Value
- func Abs(a Value) Value
- func Div(x, y Value) Value
- func Max(a, b Value) Value
- func Min(a, b Value) Value
- func Mul(x, y Value) Value
- func Must(v Value, err error) Value
- func MustNewFromBytes(input []byte) (v Value)
- func MustNewFromString(input string) Value
- func NewFromBytes(input []byte) (Value, error)
- func NewFromFloat(val float64) Value
- func NewFromInt(val int64) Value
- func NewFromString(input string) (Value, error)
- func (v Value) Abs() Value
- func (v Value) Add(v2 Value) Value
- func (v *Value) AtomicAdd(v2 Value)
- func (v *Value) AtomicLoad() Value
- func (v Value) Ceil() Value
- func (x Value) Compare(y Value) int
- func (v Value) Div(v2 Value) Value
- func (x Value) Eq(y Value) bool
- func (v Value) Float64() float64
- func (v Value) Floor() Value
- func (v Value) FormatPercentage(prec int) string
- func (v Value) FormatString(prec int) string
- func (v Value) Int() int
- func (v Value) Int64() int64
- func (v Value) IsZero() bool
- func (v Value) MarshalJSON() ([]byte, error)
- func (v Value) Mul(v2 Value) Value
- func (a Value) MulExp(exp int) Value
- func (v Value) Neg() Value
- func (a Value) NumFractionalDigits() int
- func (a Value) NumIntDigits() int
- func (v Value) Percentage() string
- func (v Value) Round(r int, mode RoundingMode) Value
- func (v *Value) Scan(src interface{}) error
- func (v Value) Sign() int
- func (v Value) SignedPercentage() string
- func (v Value) String() string
- func (v Value) Sub(v2 Value) Value
- func (v Value) Trunc() Value
- func (v *Value) UnmarshalJSON(data []byte) error
- func (v *Value) UnmarshalYAML(unmarshal func(a interface{}) error) (err error)
- func (v Value) Value() (driver.Value, error)
Constants ¶
View Source
const DefaultPow = 1e8
View Source
const DefaultPrecision = 8
View Source
const MaxPrecision = 12
View Source
const NegOne = Value(-1e8)
View Source
const One = Value(1e8)
View Source
const Zero = Value(0)
Variables ¶
View Source
var ErrPrecisionLoss = errors.New("precision loss")
Functions ¶
Types ¶
type RoundingMode ¶ added in v1.28.0
type RoundingMode int
const ( Up RoundingMode = iota Down HalfUp )
type Value ¶
type Value int64
func MustNewFromBytes ¶ added in v1.28.0
func MustNewFromString ¶ added in v1.13.0
func NewFromBytes ¶ added in v1.28.0
func NewFromFloat ¶
func NewFromInt ¶
func NewFromString ¶
func (*Value) AtomicLoad ¶ added in v1.2.0
func (Value) FormatPercentage ¶ added in v1.28.0
func (Value) FormatString ¶ added in v1.28.0
func (Value) MarshalJSON ¶ added in v1.3.1
func (Value) NumFractionalDigits ¶ added in v1.28.0
TODO: speedup
func (Value) NumIntDigits ¶ added in v1.28.0
func (Value) Percentage ¶ added in v1.18.0
func (Value) SignedPercentage ¶ added in v1.18.0
func (Value) Trunc ¶ added in v1.28.0
Trunc returns the integer portion (truncating any fractional part)
func (*Value) UnmarshalJSON ¶
func (*Value) UnmarshalYAML ¶
Click to show internal directories.
Click to hide internal directories.