models

package
v1.0.6 Latest Latest
Warning

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

Go to latest
Published: Sep 27, 2021 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildOne

func BuildOne(parent string, path string, tx *gorm.DB, parentPassword string, drive *conf.Drive, depth int) error

递归构建目录树,插入指定目录下的所有文件 parent 父目录的file_id path 指定的目录 parentPassword 父目录所携带的密码 drive 要构建的盘

func BuildTree

func BuildTree(drive *conf.Drive, depth int) error

build tree

func BuildTreeAll added in v1.0.1

func BuildTreeAll(depth int)

func BuildTreeWithPath added in v1.0.4

func BuildTreeWithPath(path string, depth int) error

重建指定路径与深度的目录树: 先删除该目录与该目录下所有文件的model,再重新插入

func Clear

func Clear(drive *conf.Drive) error

func DeleteWithDir added in v1.0.4

func DeleteWithDir(dir string) error

func GetFilesByDir

func GetFilesByDir(dir string) (*[]File, error)

func SearchByNameGlobal

func SearchByNameGlobal(keyword string) (*[]File, error)

func SearchByNameInDir

func SearchByNameInDir(keyword string, dir string) (*[]File, error)

Types

type File

type File struct {
	Dir           string     `json:"dir" gorm:"index"`
	FileExtension string     `json:"file_extension"`
	FileId        string     `json:"file_id"`
	Name          string     `json:"name" gorm:"index"`
	Type          string     `json:"type"`
	UpdatedAt     *time.Time `json:"updated_at"`
	Category      string     `json:"category"`
	ContentType   string     `json:"content_type"`
	Size          int64      `json:"size"`
	Password      string     `json:"password"`
	Url           string     `json:"url" gorm:"-"`
	ContentHash   string     `json:"content_hash"`
}

func GetFileByDirAndName

func GetFileByDirAndName(dir, name string) (*File, error)

func (*File) Create

func (file *File) Create() error

Jump to

Keyboard shortcuts

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