json/model/numberNode.go

16 lines
254 B
Go
Raw Normal View History

2022-11-21 04:31:56 +03:00
package model
import "strconv"
type NumberNode struct {
Value float64
}
func (n NumberNode) Type() NodeType {
return NumberType
}
func (n *NumberNode) MarshalJSON() ([]byte, error) {
return []byte(strconv.FormatFloat(n.Value, 'g', -1, 64)), nil
}