Documentation
¶
Index ¶
Constants ¶
View Source
const (
ErrUnableToReadFile = "unable to read file: %v"
)
Variables ¶
View Source
var (
ErrNilFile = errors.New("file cannot be nil")
)
Functions ¶
func CloseFile ¶ added in v0.2.15
CloseFile closes the file
Parameters:
- file: The file to close
Returns:
- error: An error if something went wrong
func GetCurrentDirectory ¶
GetCurrentDirectory gets the current directory of the executable
Returns:
- string: the current directory path
- error: error if any occurred while retrieving the directory
func OpenFile ¶ added in v0.2.15
OpenFile opens the file from the given path
Parameters:
- path: The path to the file
Returns:
- *os.File: The opened file
- error: An error if something went wrong
func ReadCSVFile ¶ added in v0.2.15
ReadCSVFile reads a CSV file and returns a slice of string slices
Parameters:
- file: The file to read
- readHeaders: Whether to read the first line as headers
Returns:
- *[][]string: A pointer to a slice of string slices containing the CSV records
- *[]string: A pointer to a slice of strings containing the headers (if readHeaders is true)
- error: An error if something went wrong
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.