Numeric numberTextBytes() workaround...
This seems a bit of a hack. It fixes the problems demonstrated in my previous commit. Maybe there's a cleaner way? Associated: https://github.com/jackc/pgx/issues/1426
This commit is contained in:
committed by
Jack Christensen
parent
37c6f97b11
commit
c46d792c93
@@ -243,7 +243,14 @@ func (n Numeric) MarshalJSON() ([]byte, error) {
|
|||||||
// numberString returns a string of the number. undefined if NaN, infinite, or NULL
|
// numberString returns a string of the number. undefined if NaN, infinite, or NULL
|
||||||
func (n Numeric) numberTextBytes() []byte {
|
func (n Numeric) numberTextBytes() []byte {
|
||||||
intStr := n.Int.String()
|
intStr := n.Int.String()
|
||||||
|
|
||||||
buf := &bytes.Buffer{}
|
buf := &bytes.Buffer{}
|
||||||
|
|
||||||
|
if len(intStr) > 0 && intStr[:1] == "-" {
|
||||||
|
intStr = intStr[1:]
|
||||||
|
buf.WriteByte('-')
|
||||||
|
}
|
||||||
|
|
||||||
exp := int(n.Exp)
|
exp := int(n.Exp)
|
||||||
if exp > 0 {
|
if exp > 0 {
|
||||||
buf.WriteString(intStr)
|
buf.WriteString(intStr)
|
||||||
|
|||||||
Reference in New Issue
Block a user