bigdecimal

package
v0.0.0-...-cb7fc92 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 15, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AllowedCharacters = "0123456789.-eE"
	BigDecRegEx       = "-?(?:[0|1-9]\\d*)(?:\\.\\d+)?(?:[eE][+\\-]?\\d+)?"
)

Variables

View Source
var (
	ErrInvalidCharacter = fmt.Errorf("value contains invalid characters. Only the following are allowed: %q", AllowedCharacters)
	ErrInvalidZeroValue = errors.New("value cannot be zero")
	ErrInvalidScale     = errors.New("scale too large")
)

Functions

This section is empty.

Types

type BigDecimal

type BigDecimal struct {
	Scale         int
	Precision     int
	UnscaledValue string
	Sign          int // 1 for negative, 0 for positive
}

func NewBigDecimal

func NewBigDecimal(value string) (bd *BigDecimal, err error)

Creates a new custom BigDecimal object from a value string

func (*BigDecimal) GetScaledValue

func (bd *BigDecimal) GetScaledValue() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL