tree

package
v0.0.0-...-00a7b0a Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 28, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package tree ...

Description : tree ...

Author : go_developer@163.com<白茶清欢>

Date : 2023-03-28 18:32

Package tree ...

Description : tree ...

Author : go_developer@163.com<白茶清欢>

Date : 2023-03-28 18:42

Package tree ...

Description : tree ...

Author : go_developer@163.com<白茶清欢>

Date : 2023-03-28 18:12

Index

Constants

View Source
const (
	// KeywordObjectStart 对象开始标识
	KeywordObjectStart = "{"
	// KeywordObjectEnd 对象结束标识
	KeywordObjectEnd = "}"
	// KeywordArrayStart 数组开始标识
	KeywordArrayStart = "["
	// KeywordArrayEnd 数组结束标识
	KeywordArrayEnd = "]"
	// KeywordColon 冒号
	KeywordColon = ":"
	// KeywordComma 逗号
	KeywordComma = ","
	// KeywordDot .
	KeywordDot = "."
	// KeywordDoubleQuote 双引号
	KeywordDoubleQuote = `"`
	// KeywordEscapeSymbol 转义符号
	KeywordEscapeSymbol = `\`
	// KeywordSpace 空格
	KeywordSpace = " "
	// KeywordMinus 负号
	KeywordMinus = "-"
	// KeywordTrueStart true的起始值
	KeywordTrueStart = "t"
	// KeywordFalseStart false的起始值
	KeywordFalseStart = "f"
	KeywordZero       = "0"
	KeywordOne        = "1"
	KeywordTwo        = "2"
	KeywordThree      = "3"
	KeywordFour       = "4"
	KeywordFive       = "5"
	KeywordSix        = "6"
	KeywordSeven      = "7"
	KeywordEight      = "8"
	KeywordNine       = "9"
)
View Source
const (
	// ValueTypeString 字符串类型
	ValueTypeString = "string"
	// ValueTypeBool bool类型
	ValueTypeBool = "bool"
	// ValueTypeInteger int类型
	ValueTypeInteger = "int64"
	// ValueTypeFloat float类型
	ValueTypeFloat = "float64"
	// ValueTypeNumber 数字
	ValueTypeNumber = "number"
	// ValueTypeMap map数据
	ValueTypeMap = "map"
	// ValueTypeArray 数组
	ValueTypeArray = "array"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Generate

type Generate struct {
	// contains filtered or unexported fields
}

Generate ...

Author : go_developer@163.com<白茶清欢>

Date : 22:46 2023/3/28

func New

func New(jsonData string) (*Generate, error)

New 生成一棵JSON树

Author : go_developer@163.com<白茶清欢>

Date : 18:42 2023/3/28

type Node

type Node struct {
	IsVirtual       bool        // 是否虚拟节点, 主要应对输入的原始数据为list这一场景
	Value           interface{} // 节点的值
	ValueType       string      // 数据类型 string / int64 / float64 / map / list / nil
	Key             string      // 节点的key名称(输入的原始名称)
	Show            bool        // 节点是否可见
	ShowKey         string      // 重新序列化后, 对外输出的Key
	AllowEdit       bool        // 当前key是否允许编辑
	AllowChangeType bool        // 在允许编辑的情况下, 是否允许修改数据类型
	DefaultValue    interface{} // 输入为value为nil时候的默认值
	ParentNode      *Node       // 父节点
	PreBrotherNode  *Node       // 前一个兄弟节点
	LastBrotherNode *Node       // 下一个兄弟节点
	SonNodeList     []*Node     // 子节点列表
	ObjectStack     []string    // 对象信息堆栈, 利用栈的括号匹配, 判断某一个对象是否扫面完成
}

Node 节点的数据结构

Author : go_developer@163.com<白茶清欢>

Date : 18:12 2023/3/28

func NewNode

func NewNode(key string, value string, valueType string, parentNode *Node) *Node

NewNode 创建新节点

Author : go_developer@163.com<白茶清欢>

Date : 23:02 2023/3/28

func NewVirtualNode

func NewVirtualNode() *Node

NewVirtualNode 创建一个新的虚拟节点

Author : go_developer@163.com<白茶清欢>

Date : 23:08 2023/3/28

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL