diff options
Diffstat (limited to 'factory.go')
-rw-r--r-- | factory.go | 46 |
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) +} |