aboutsummaryrefslogtreecommitdiff
path: root/factory.go
blob: bf4452517e256fdbd2edcba4978f7f0ce37e6327 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
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 {
	SetParent(n Node)
}