url_tree

package
v3.34.0 Latest Latest
Warning

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

Go to latest
Published: May 2, 2024 License: AGPL-3.0 Imports: 13 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Addition

type Addition struct {
	// Usually one of two
	// driver.RootPath
	// driver.RootID
	// define other
	UrlStructure string `` /* 394-byte string literal not displayed */
	HeadSize     bool   `json:"head_size" type:"bool" default:"false" help:"Use head method to get file size, but it may be failed."`
}

type Node

type Node struct {
	Url      string
	Name     string
	Level    int
	Modified int64
	Size     int64
	Children []*Node
}

Node is a node in the folder tree

func BuildTree

func BuildTree(text string, headSize bool) (*Node, error)

build tree from text, text structure definition: *

  • FolderName:
  • [FileName:][FileSize:][Modified:]Url

*

  • For example:
  • folder1:
  • name1:url1
  • url2
  • folder2:
  • url3
  • url4
  • url5
  • folder3:
  • url6
  • url7
  • url8

if there are no name, use the last segment of url as name

func GetNodeFromRootByPath

func GetNodeFromRootByPath(root *Node, path string) *Node

type Urls

type Urls struct {
	model.Storage
	Addition
	// contains filtered or unexported fields
}

func (*Urls) Config

func (d *Urls) Config() driver.Config

func (*Urls) Drop

func (d *Urls) Drop(ctx context.Context) error

func (*Urls) Get

func (d *Urls) Get(ctx context.Context, path string) (model.Obj, error)

func (*Urls) GetAddition

func (d *Urls) GetAddition() driver.Additional

func (*Urls) Init

func (d *Urls) Init(ctx context.Context) error
func (d *Urls) Link(ctx context.Context, file model.Obj, args model.LinkArgs) (*model.Link, error)

func (*Urls) List

func (d *Urls) List(ctx context.Context, dir model.Obj, args model.ListArgs) ([]model.Obj, error)

Jump to

Keyboard shortcuts

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