Documentation
¶
Index ¶
- type LTree
- func (t *LTree) BuildLTreePath(parentPath, currentValue string) string
- func (t *LTree) ExtractLastSegment(path string) string
- func (t *LTree) GetLTreeDepth(path string) int
- func (t *LTree) IsDescendantPath(descendantPath, ancestorPath string) bool
- func (t *LTree) ReplaceCurrentPath(oldPath, currentPath string) string
- func (t *LTree) ReplacePathPrefix(oldPath, newPath, fullPath string) string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type LTree ¶
type LTree struct{}
LTree 提供 PostgreSQL ltree 风格的标签树路径操作工具 用于处理类似 "A.B.C" 的层级路径结构
func (*LTree) BuildLTreePath ¶
BuildLTreePath 构建子节点路径 parentPath: 父节点路径 currentValue: 当前节点值 返回: "parentPath.currentValue",如果 parentPath 为空则返回 currentValue
func (*LTree) ExtractLastSegment ¶
ExtractLastSegment 提取路径的最后一段(即当前节点名) 例如: "A.B.C" -> "C"
func (*LTree) GetLTreeDepth ¶
GetLTreeDepth 计算标签树路径的深度 深度定义为路径中层级的数量(即点的数量 + 1) 例如: "A.B.C" 的深度为 3
func (*LTree) IsDescendantPath ¶
IsDescendantPath 检查路径是否是后代路径
func (*LTree) ReplaceCurrentPath ¶
ReplaceCurrentPath 替换当前路径
func (*LTree) ReplacePathPrefix ¶
ReplacePathPrefix 替换路径前缀,常用于移动子树 oldPath: 旧的前缀(如 "A.B") newPath: 新的前缀(如 "X.Y") fullPath: 包含旧前缀的完整路径(如 "A.B.C.D") 返回: 替换后的路径(如 "X.Y.C.D")。如果 fullPath 不以 oldPath 开头,则原样返回
Click to show internal directories.
Click to hide internal directories.