优化自动生成json #3
@ -32,6 +32,7 @@ type Node struct {
|
||||
PreBrotherNode *Node // 前一个兄弟节点
|
||||
LastBrotherNode *Node // 下一个兄弟节点
|
||||
SonNodeList []*Node // 子节点列表
|
||||
ObjectStack []string // 对象信息堆栈, 利用栈的括号匹配, 判断某一个对象是否扫面完成
|
||||
}
|
||||
|
||||
// NewNode 创建新节点
|
||||
@ -54,6 +55,7 @@ func NewNode(key string, value string, valueType string, parentNode *Node) *Node
|
||||
PreBrotherNode: nil,
|
||||
LastBrotherNode: nil,
|
||||
SonNodeList: nil,
|
||||
ObjectStack: make([]string, 0),
|
||||
}
|
||||
|
||||
switch valueType {
|
||||
@ -98,5 +100,9 @@ func NewNode(key string, value string, valueType string, parentNode *Node) *Node
|
||||
//
|
||||
// Date : 23:08 2023/3/28
|
||||
func NewVirtualNode() *Node {
|
||||
return &Node{IsVirtual: true, SonNodeList: make([]*Node, 0)}
|
||||
return &Node{
|
||||
IsVirtual: true,
|
||||
SonNodeList: make([]*Node, 0),
|
||||
ObjectStack: make([]string, 0),
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user