entity

package
v1.7.2 Latest Latest
Warning

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

Go to latest
Published: Jun 5, 2023 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	OutputModeTextFile = "text"
	OutputModeCsvFile  = "csv"
	OutputModeStdOut   = "print"
	OutputModeJSON     = "json"
)

Different output modes

Variables

View Source
var OutputModes = map[string]string{
	OutputModeTextFile: "creates a text file in current directory with basic information",
	OutputModeCsvFile:  "creates a csv file in current directory with detailed information",
	OutputModeStdOut:   "just prints the report without creating any file",
	OutputModeJSON:     "creates a JSON file in the current directory with basic information",
}

OutputModes and their brief descriptions

Functions

func FileDigestComparator

func FileDigestComparator(a, b any) int

FileDigestComparator is a comparator for FileDigest that compares FileSize, FileExtension and FileHash in that order

Types

type DigestToFiles

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

DigestToFiles is a multi-map with FileDigest keys and string values. Writes to this is goroutine-safe.

func NewDigestToFiles

func NewDigestToFiles() (m *DigestToFiles)

NewDigestToFiles creates new DigestToFiles

func (*DigestToFiles) Iterator

func (m *DigestToFiles) Iterator() *digestToFilesIterator

Iterator returns an iterator for a DigestToFiles map

func (*DigestToFiles) Remove

func (m *DigestToFiles) Remove(fd FileDigest)

Remove removes entry in the map

func (*DigestToFiles) Set

func (m *DigestToFiles) Set(key FileDigest, value string)

Set sets a value for the key

func (*DigestToFiles) Size

func (m *DigestToFiles) Size() int

Size returns size of map

type FileDigest

type FileDigest struct {
	FileExtension string `json:"ext"`
	FileSize      int64  `json:"size"`
	FileHash      string `json:"hash"`
}

FileDigest contains properties of a file that makes the file unique to a very high degree of confidence

func (FileDigest) String

func (f FileDigest) String() string

String returns a string representation of FileDigest

type FileExtAndSize

type FileExtAndSize struct {
	FileExtension string
	FileSize      int64
}

FileExtAndSize is a struct of file extension and file size

func (FileExtAndSize) String

func (f FileExtAndSize) String() string

String returns a string representation of FileExtAndSize

type FileExtAndSizeToFiles

type FileExtAndSizeToFiles map[FileExtAndSize][]string

FileExtAndSizeToFiles is a multi-map of FileExtAndSize key and string values

type FileMeta

type FileMeta struct {
	Size              int64
	ModifiedTimestamp int64
}

FileMeta is a combination of file size and its modification timestamp

func (FileMeta) String

func (f FileMeta) String() string

String returns a string representation of FileMeta

type FilePathToMeta

type FilePathToMeta map[string]FileMeta

FilePathToMeta is a map of file path to its FileMeta

Jump to

Keyboard shortcuts

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