csv

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Feb 9, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package csv provides CSV import/export functionality for database operations.

Index

Constants

View Source
const (
	Header    = "sha256_sum,path#"    // Header that is inserted into exported CSV files.
	WinOS     = "windows"             // WinOS is the Windows operating system.s
	BackSlash = "\u005C"              // BackSlash Unicode representation.
	FwdSlash  = "\u002F"              // FwdSlash is a forward slash Unicode representation.
	UncPath   = BackSlash + BackSlash // UncPath is the  Universal Naming Convention path.
)

Variables

View Source
var (
	ErrHexDec       = errors.New("hexadecimal value is invalid")
	ErrFileNoDesc   = errors.New("no file descriptor")
	ErrImportFile   = errors.New("not a valid dupers export file")
	ErrImportPath   = errors.New("import item has an invalid file path")
	ErrImportSyntax = errors.New("import item has incorrect syntax")
)

Functions

func Bucket

func Bucket(header string) string

Bucket validates the header of a csv file and returns the embedded bucket name.

func Checker

func Checker(file *os.File) error

Checker reads the first line in the export csv file and returns nil if it uses the expected syntax.

func Checksum

func Checksum(s string) ([32]byte, error)

Checksum returns a 64 character hexadecimal string as a bytes representation.

func Import

func Import(line, bucket string) ([32]byte, string, error)

Import reads, validates and returns a line of data from an export csv file.

Returned is the checksum and the path.

func PathPosix

func PathPosix(src string) string

PathPosix returns POSIX path from the source path.

func PathWindows

func PathWindows(src string) string

PathWindows returns a Windows or UNC usable path from the source path.

Types

type Filepath

type Filepath string // Filepath is the absolute path to a file used as a map key.

Jump to

Keyboard shortcuts

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