dtree

package
v0.0.0-...-a18d6c5 Latest Latest
Warning

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

Go to latest
Published: May 23, 2020 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FileInfo

type FileInfo struct {
	Name    string      `json:"name"`
	Size    int64       `json:"size"`
	Mode    os.FileMode `json:"mode"`
	ModTime time.Time   `json:"mod_time"`
	IsDir   bool        `json:"is_dir"`
}

FileInfo is a struct created from os.FileInfo interface for serialization.

type Node

type Node struct {
	FullPath string    `json:"path"`
	Info     *FileInfo `json:"info"`
	Children []*Node   `json:"children"`
	Parent   *Node     `json:"-"`
}

Node represents a node in a directory tree.

func BuildTreeForExt

func BuildTreeForExt(fs afero.Fs, root string, ext ...string) (*Node, error)

func NewTree

func NewTree(fs afero.Fs, root string, filter func(node *Node) bool) (result *Node, err error)

Create directory hierarchy.

func (Node) Len

func (n Node) Len() int

func (Node) Less

func (n Node) Less(i, j int) bool

func (Node) Swap

func (n Node) Swap(i, j int)

type VueTree

type VueTree struct {
	Title    string    `json:"title"`
	FullPath string    `json:"full_path"`
	Expand   bool      `json:"expand"`
	IsDir    bool      `json:"is_dir"`
	Children []VueTree `json:"children"`
}

func BuildVueTreeForExt

func BuildVueTreeForExt(fs afero.Fs, root string, ext ...string) (*VueTree, error)

Jump to

Keyboard shortcuts

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