files

package
v0.0.0-...-b89426d Latest Latest
Warning

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

Go to latest
Published: Feb 8, 2024 License: GPL-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddOneCsvRow

func AddOneCsvRow(writer *csv.Writer, row []string) error

///////////////////////////////////////////////////////////////////////// Add one row to CSV file

func AddOneMetaRow

func AddOneMetaRow(writer *csv.Writer, dataRow config.RowTypesMeta) error

///////////////////////////////////////////////////////////////////////// Add a single row to meta CSV file using specific format

func CountAndListCSVFiles

func CountAndListCSVFiles(folderPath string) (int, []string, error)

Count and list folder paths locally inside specified folder path

func DeleteLocalFolder

func DeleteLocalFolder(folderToDelete string) error

Delete local folder entirely

func DetermineBackupFileName

func DetermineBackupFileName(fileName string, fileNumber int, collectionName string, timeStamp string, fileSizeExceeding bool) (newFileName string, newFileNumber int, oldNameBackupFile string, err error)

Determine file name depending on backup file size. Create new backup file name if cureent file size exceeds maximum size by using base backup file name and utilizing subsequent numbering

func GetFilePath

func GetFilePath(fileName string, timeStamp string) (filePath string)

Get entire file path depending on timestamp, file name and name of backup folder

func GetFileSizeByDescriptor

func GetFileSizeByDescriptor(file *os.File) (int64, error)

Get file size in bytes of any file type by using Go file descriptor as parameter type

func GetFileSizeByPath

func GetFileSizeByPath(filePath string) (int64, error)

Get file size in bytes of any file type by using Go file descriptor as parameter type

func GetSubFolder

func GetSubFolder(timeStamp string) (pathSubFolder string)

Create name of subfolder path

func IsFileEmptyByDescriptor

func IsFileEmptyByDescriptor(file *os.File) (bool, error)

Validate if file of any type is empty by using Go file descriptor as parameter type

func IsFileEmptyByFilePath

func IsFileEmptyByFilePath(filePath string) (bool, error)

Validate if file of any type is empty by using file path of type string

func ListLocalFolderNames

func ListLocalFolderNames(folderPath string) ([]string, error)

List all folder names as string slice inside a given local path

func LocalFileExists

func LocalFileExists(path string) (bool, error)

/////////////////////////////////////////////////////////// Check if local file exists /////////

func LocalFolderExists

func LocalFolderExists(folderPath string) (bool, error)

/////////////////////////////////////////////////////////// Check if folder exists /////////

func ValidateCSVHeaders

func ValidateCSVHeaders(csvFile *os.File, expectedHeaders []string) error

///////////////////////////////////////////////////////////////////////////// Validate headers of csv file /////////

func WillExceedBackupFileSize

func WillExceedBackupFileSize(dataToAdd *[]primitive.M, filePath string) (fileTooLarge bool, err error)

func WriteHeadersToCsvFile

func WriteHeadersToCsvFile(file *os.File, headers []string) error

///////////////////////////////////////////////////////////////////// Write headers (using slice of strings) to csv file

Types

This section is empty.

Jump to

Keyboard shortcuts

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