aboutsummaryrefslogtreecommitdiff
path: root/model/numberNode.go
diff options
context:
space:
mode:
Diffstat (limited to 'model/numberNode.go')
-rw-r--r--model/numberNode.go15
1 files changed, 15 insertions, 0 deletions
diff --git a/model/numberNode.go b/model/numberNode.go
new file mode 100644
index 0000000..e1bffd9
--- /dev/null
+++ b/model/numberNode.go
@@ -0,0 +1,15 @@
+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
+}