Help us shape the future of Go! Take the 2026 Go Developer Survey

models

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2026 License: GPL-3.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CollisionPolicy

type CollisionPolicy string

CollisionPolicy defines how to handle existing destination files.

const (
	CollisionSkip    CollisionPolicy = "skip"
	CollisionRename  CollisionPolicy = "rename"
	CollisionReplace CollisionPolicy = "replace"
	CollisionAbort   CollisionPolicy = "abort"
)

type Condition

type Condition struct {
	Field    TargetField `json:"field" toml:"field"`
	Operator Operator    `json:"operator" toml:"operator"`
	Value    string      `json:"value" toml:"value"`
}

Condition defines an evaluation rule for a file.

type File

type File struct {
	Path      string    `json:"path"`      // Absolute or full path
	RelPath   string    `json:"rel_path"`  // Relative path from chest root
	Name      string    `json:"name"`      // Filename including extension
	Extension string    `json:"extension"` // Lowercase extension without dot (e.g. "mp4", "png")
	Size      int64     `json:"size"`      // Size in bytes
	ModTime   time.Time `json:"mod_time"`  // Last modification time
	IsDir     bool      `json:"is_dir"`    // Is directory
	IsHidden  bool      `json:"is_hidden"` // Is hidden or system file
	MIMEType  string    `json:"mime_type"` // MIME type (if available)
	Category  string    `json:"category"`  // High-level category (Image, Video, etc.)
}

File represents a file inspected by CHEST.

type HistoryEntry

type HistoryEntry struct {
	ID         int                `json:"id"`
	Timestamp  time.Time          `json:"timestamp"`
	Directory  string             `json:"directory"`
	Operations []HistoryOperation `json:"operations"`
	FilesCount int                `json:"files_count"`
	Status     string             `json:"status"` // "Complete", "Undone"
}

HistoryEntry stores a batch organization run.

type HistoryOperation

type HistoryOperation struct {
	OriginalSource string `json:"original_source"`
	Destination    string `json:"destination"`
	Reason         string `json:"reason"`
}

HistoryOperation stores an individual reversed/applied file move.

type Operation

type Operation struct {
	Source      string          `json:"source"`
	Destination string          `json:"destination"`
	Reason      string          `json:"reason"`
	Action      CollisionPolicy `json:"action"` // what will happen if collision exists
	IsCollision bool            `json:"is_collision"`
}

Operation represents a single proposed or executed file move.

type Operator

type Operator string

Operator defines comparison operator.

const (
	OpEqual       Operator = "="
	OpNotEqual    Operator = "!="
	OpGreaterThan Operator = ">"
	OpLessThan    Operator = "<"
	OpGreaterEq   Operator = ">="
	OpLessEq      Operator = "<="
	OpContains    Operator = "contains"
	OpStartsWith  Operator = "starts_with"
	OpEndsWith    Operator = "ends_with"
	OpGlob        Operator = "glob"
	OpRegex       Operator = "regex"
)

type Plan

type Plan struct {
	RootPath        string      `json:"root_path"`
	Operations      []Operation `json:"operations"`
	FoldersToCreate []string    `json:"folders_to_create"`
	TotalFiles      int         `json:"total_files"`
	SkippedFiles    int         `json:"skipped_files"`
}

Plan represents the complete set of proposed filesystem changes.

type Rule

type Rule struct {
	Name        string      `json:"name" toml:"name"`
	Priority    int         `json:"priority" toml:"priority"`
	Conditions  []Condition `json:"conditions" toml:"conditions"`
	Destination string      `json:"destination" toml:"destination"`
	Extensions  []string    `json:"extensions,omitempty" toml:"extensions,omitempty"` // convenience helper in presets
	MinSize     string      `json:"min_size,omitempty" toml:"min_size,omitempty"`     // convenience helper in presets
	MaxSize     string      `json:"max_size,omitempty" toml:"max_size,omitempty"`     // convenience helper in presets
	Type        string      `json:"type,omitempty" toml:"type,omitempty"`             // convenience helper in presets
}

Rule defines sorting rule.

type TargetField

type TargetField string

TargetField defines what attribute of the file the condition inspects.

const (
	FieldExtension TargetField = "extension"
	FieldFormat    TargetField = "format"
	FieldType      TargetField = "type"
	FieldSize      TargetField = "size"
	FieldName      TargetField = "name"
	FieldDate      TargetField = "date"
	FieldModTime   TargetField = "mod_time"
	FieldMIME      TargetField = "mime"
)

Jump to

Keyboard shortcuts

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