fileutils

package
v0.0.0-...-e51d946 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2019 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package fileutils any file based interactions

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HeadersToRegex

func HeadersToRegex(headers []string) string

HeadersToRegex simple function to convert a slice of string headers to a regex

headers: slice of headers to use in a "form style" regex, for example:

Headers: HEADER1,HEADER2,HEADER3 Regex returned: `HEADER1: (.*)\n\nHEADER2: (.*)\n\HEADER3: (.*)`

func WriteTextOutput

func WriteTextOutput(fileName string, c chan reddit.Comment)

WriteTextOutput to write txt output based on a channel to a file fileName: name of write to write to, c: channel

Types

type CsvWriter

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

CsvWriter custom type for safe concurrent access for csv writing Source: https://markhneedham.com/blog/2017/01/31/go-multi-threaded-writing-csv-file/

func NewCsvWriter

func NewCsvWriter(fileName string) (*CsvWriter, error)

NewCsvWriter creates new writer and returns reference

func (*CsvWriter) Flush

func (w *CsvWriter) Flush()

Flush the file, lock, unlock mutex

func (*CsvWriter) Write

func (w *CsvWriter) Write(row []string)

Jump to

Keyboard shortcuts

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