files

package module
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Jun 4, 2021 License: MIT Imports: 18 Imported by: 0

README

files

文件搜索,仿照 Everything,提供按照文件类型搜索,文件尺寸搜索等功能

v1.0

  • 增加目录
    • 子目录识别
    • 删除目录
  • 文件索引
    • 文件尺寸
    • 扩展文件名
  • 搜索
    • 扩展文件名搜索
    • 包含
    • 多条件
    • 排除
    • 排序
    • 多进程索引
    • 统配搜索
    • 正则表达式搜索

v1.1

  • 文件类型
    • 音频
    • 压缩文件
    • 文档
    • 可执行文件
    • 文件夹
    • 图片
    • 视频
  • 类型搜索
  • 图形界面
    • 后台更新
  • 忽略
    • 忽略目录
    • 忽略文件
    • 忽略扩展名
    • 忽略类型
  • 批量改名
  • 文件预览
  • 磁盘空间占用饼图

Documentation

Index

Constants

View Source
const (
	// ByteDir 目录.
	ByteDir = iota
	// ByteFile 文件.
	ByteFile
	// ByteConfig 配置.
	ByteConfig
	// ByteSeq 序列.
	ByteSeq
	// ByteStack 堆栈.
	ByteStack
	// ByteIgnore 忽略.
	ByteIgnore
)

Variables

This section is empty.

Functions

func NewDB

func NewDB(ctx *Context) *gorm.DB

NewDBService 新建数据库.

func NewTestDB added in v1.0.2

func NewTestDB() *gorm.DB

NewTestDB 测试数据库.

Types

type App

type App struct {
	// contains filtered or unexported fields
}

App 应用.

func InitApp

func InitApp(ctx *Context) *App

InitApp 初始化应用.

func NewApp

func NewApp(
	ctx *Context,
	fs *Service,
) *App

NewApp 新建应用.

func (*App) Add

func (p *App) Add(paths []string)

Add 目录.

func (*App) Ignore

func (p *App) Ignore(paths []string)

Ignore 忽略目录.

func (*App) Search

func (p *App) Search(args []string)

Search 搜索.

type Config

type Config struct {
	ID        uint `gorm:"primarykey"`
	CreatedAt time.Time
	Type      int
	Value     string
}

Config 配置.

type Context

type Context struct {
	// DataBasePath 数据库目录.
	DataBasePath string
	Limit        int
	Offset       int
	Ext          string
	// Simple 简单输出格式.
	Simple    bool
	Debug     bool
	Remove    bool
	Order     string
	Desc      bool
	Regexp    bool
	HasRegexp bool
}

Context 上下文.

func NewContext

func NewContext(cmd *cobra.Command) *Context

NewContext 新建上下文.

type File

type File struct {
	Path    string `gorm:"primarykey"`
	ModTime time.Time
	Base    string
	Ext     string
	Size    int64
	Dir     bool
	Ver     int
}

File 文件.

type Service

type Service struct {
	// contains filtered or unexported fields
}

Service 服务.

func NewService

func NewService(
	ctx *Context,
	db *gorm.DB,
) *Service

NewService 新建服务.

func (*Service) Add

func (p *Service) Add(path string)

Add 增加目录.

func (*Service) Count

func (p *Service) Count(args []string) int64

Count 统计.

func (*Service) Dirs

func (p *Service) Dirs() []string

Dirs 搜索目录.

func (*Service) Ignore

func (p *Service) Ignore(path string)

Ignore 忽略目录.

func (*Service) Ignores

func (p *Service) Ignores() []string

Ignores 搜索目录.

func (*Service) Index

func (p *Service) Index()

Index 索引.

func (*Service) RemoveDir

func (p *Service) RemoveDir(path string)

RemoveDir 删除忽略.

func (*Service) RemoveFiles

func (p *Service) RemoveFiles(path string)

RemoveFiles 删除目录文件.

func (*Service) RemoveIgnore

func (p *Service) RemoveIgnore(path string)

RemoveIgnore 删除忽略.

func (*Service) Search

func (p *Service) Search(args []string) []*File

Search 搜索.

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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