From efd9060fb89793fe6c6bc042b16e27c89c95aef5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=99=BD=E8=8C=B6=E6=B8=85=E6=AC=A2?= Date: Tue, 28 Mar 2023 18:17:43 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0node=E5=AE=9A=E4=B9=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tree/REDME.md | 3 +++ tree/node.go | 24 ++++++++++++++++++++++++ 2 files changed, 27 insertions(+) create mode 100644 tree/REDME.md create mode 100644 tree/node.go diff --git a/tree/REDME.md b/tree/REDME.md new file mode 100644 index 0000000..e74d0a8 --- /dev/null +++ b/tree/REDME.md @@ -0,0 +1,3 @@ +# 说明 + +基于JSON数据生成数据树 diff --git a/tree/node.go b/tree/node.go new file mode 100644 index 0000000..17c05d2 --- /dev/null +++ b/tree/node.go @@ -0,0 +1,24 @@ +// Package tree ... +// +// Description : tree ... +// +// Author : go_developer@163.com<白茶清欢> +// +// Date : 2023-03-28 18:12 +package tree + +// Node 节点的数据结构 +// +// Author : go_developer@163.com<白茶清欢> +// +// Date : 18:12 2023/3/28 +type Node struct { + Value interface{} // 节点的值 + ValueType string // 数据类型 int64 / float64 / map / list / nil + Key string // 节点的key名称(输入的原始名称) + Show bool // 节点是否可见 + ShowKey string // 重新序列化后, 对外输出的Key + AllowEdit bool // 当前key是否允许编辑 + AllowChangeType bool // 在允许编辑的情况下, 是否允许修改数据类型 + DefaultValue interface{} // 输入为value为nil时候的默认值 +}