aboutsummaryrefslogtreecommitdiff
path: root/factory.go
diff options
context:
space:
mode:
authorNeonXP <i@neonxp.dev>2022-12-27 02:37:02 +0300
committerNeonXP <i@neonxp.dev>2022-12-27 02:40:03 +0300
commit76a7f461ebbde70ea0e3d4f9b79c08139acaee7c (patch)
tree5e6dcb05f00be5109b3465ef16a6e9169a27497e /factory.go
parent6f1d1df79f161cfc695f74d271d689ba72c44d09 (diff)
Completely rewritedv0.1.0
Diffstat (limited to 'factory.go')
-rw-r--r--factory.go46
1 files changed, 46 insertions, 0 deletions
diff --git a/factory.go b/factory.go
new file mode 100644
index 0000000..285c235
--- /dev/null
+++ b/factory.go
@@ -0,0 +1,46 @@
+package json
+
+type NodeFactory func(typ NodeType) (Node, error)
+
+type Node interface {
+ String() string
+}
+
+type ObjectNode interface {
+ Node
+ SetKeyValue(k string, v Node)
+ GetByKey(k string) (Node, bool)
+}
+
+type ArrayNode interface {
+ Node
+ Append(v Node)
+ Index(i int) Node
+ Len() int
+}
+
+type StringNode interface {
+ Node
+ SetString(v string)
+ GetString() string
+}
+
+type NumberNode interface {
+ Node
+ SetNumber(v float64)
+ GetNumber() float64
+}
+
+type BooleanNode interface {
+ Node
+ SetBool(v bool)
+ GetBool() bool
+}
+
+type NullNode interface {
+ Node
+}
+
+type AcceptParent interface {
+ Parent(n Node)
+}