tree

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Jul 28, 2026 License: GPL-3.0 Imports: 23 Imported by: 0

Documentation

Overview

Package tree 实现文件目录树工具,支持递归展示与克隆操作

该包生成文件系统的目录树结构,并支持平台特定的目录克隆

Index

Constants

View Source
const MaxChildrenNum = 100

MaxChildrenNum 最大子节点数

View Source
const MaxDepth = 6

MaxDepth 最大递归深度

View Source
const MaxNodeCount = 1000

MaxNodeCount 最大节点个数 (真实案例:递归扫用户目录 OOM)

Variables

This section is empty.

Functions

func BuildString

func BuildString(node *Node) string

BuildString 构建字符串

Types

type Diff

type Diff struct {
	Origin string
	Target string
	Type   DiffStatus
}

Diff 执行差异表

func SolveCall

func SolveCall(path string, node *Node, dist string) ([]Diff, error)

SolveCall 解决调用

type DiffStatus

type DiffStatus int8

DiffStatus 差异表状态

const (
	DiffStatusCreateDir DiffStatus = iota
	DiffStatusCreateFile
	DiffStatusMove
	DiffStatusCopy
	DiffStatusDelete
)

差异类型

type Node

type Node struct {
	Name        string
	Children    []*Node
	Path        string
	IsDir       bool
	ChildrenNum int32
	Error       error
	ID          int32
	IDStart     int32
	IDEnd       int32
	RemoveFlag  bool
}

Node 树节点

func BuildNodeFromString

func BuildNodeFromString(str string) (*Node, error)

BuildNodeFromString 从字符串构建节点

func BuildTree

func BuildTree(dir string, ID *int32) (*Node, []error)

BuildTree 构建树

Directories

Path Synopsis
Package ios 提供文件与目录克隆的平台特定实现
Package ios 提供文件与目录克隆的平台特定实现

Jump to

Keyboard shortcuts

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