Documentation
¶
Index ¶
- Variables
- func AppendFile(file string) *os.File
- func CheckError(msg string, err error, code int) bool
- func CreateFile(file string) *os.File
- func Exists(path string) bool
- func FindDelim(infile string) (string, error)
- func FormatPath(path string, makenew bool) (string, bool)
- func GetDelim(header string) (string, error)
- func GetExt(file string) string
- func GetFileName(file string) string
- func GetGOPATH() string
- func GetHeader(row []string) map[string]int
- func GetParent(path string) string
- func GetScanner(f *os.File) *bufio.Scanner
- func Gzip(outfile, header string, results [][]string)
- func OpenFile(file string) *os.File
- func ReadFile(infile string, header bool) ([][]string, map[string]int)
- func WriteToCSV(outfile, header string, results [][]string)
- func YieldFile(infile string, header bool) (<-chan []string, map[string]int)
Constants ¶
This section is empty.
Variables ¶
var DELIM = []string{"\t", ",", "|", ";", ":", " "}
Functions ¶
func AppendFile ¶
AppendFile opens the file at the given file path and returns file stream in append mode. It will exit if it encounters an error.
func CheckError ¶
CheckError returns true if err is nil; otherwise, if code is 0 it prints a warning and returns false. If code is not 0, it prints an error formatted with msg and exits with code.
func CreateFile ¶
CreateFile creates a file at the given file path and returns a file stream. It will exit if it encounters an error.
func FindDelim ¶
FindDelim returns delimiter (tab, comma, pipe, semicolon, colon, or space) from a text file. Returns an error if delimiter cannot be found.
func FormatPath ¶
FormatPath returns path name with trailing slash (os.PathSeparator) and makes the directory if makenew is true.
func GetDelim ¶
GetDelim returns delimiter (tab, comma, pipe, semicolon, colon, or space) from a line of a text file. Returns an error if delimiter cannot be found.
func GetFileName ¶
GetFileName returns the base name (everything between the final slash and first period) from file.
func GetScanner ¶
GetScanner determines if a file is gzipped or not returns the appropriate scanner. It will exit if it encounters an error.
func OpenFile ¶
OpenFile opens the file at the given file path and returns a file stream. It will exit if it encounters an error.
func ReadFile ¶
ReadFile reads in compressed and uncompressed text files as a two dimensional slice of strings and the header as a map of indeces.
func WriteToCSV ¶
WriteToCSV writes a string header and a two dimensional slice of strings to csv. Gzips file if last three characters of file name are '.gz'.
Types ¶
This section is empty.