Documentation ¶
Index ¶
- Constants
- Variables
- func ColIndexToLetters(colIndex uint32) string
- func ColNumberToLetters(colNumber uint32) string
- func CoordinateNumbersToSheetLocation(colNum, rowNum uint32) string
- func CoordinatesToSheetLocation(colIdx, rowIdx uint32) string
- func FormatStringAndFloats(val string, colIdx uint) (interface{}, error)
- func FormatStringAndInts(val string, colIdx uint) (interface{}, error)
- func FormatStrings(val string, col uint) (interface{}, error)
- func FormatTimeAndFloats(val string, colIdx uint) (interface{}, error)
- func FormatTimeAndInts(val string, colIdx uint) (interface{}, error)
- func MergeFilterCSVFilesToJSON(inPaths []string, outPath string, inComma rune, inStripBom bool, ...) error
- func ReadCSVFileSingleColumnValuesString(filename, sep string, hasHeader, trimSpace bool, col uint, ...) ([]string, error)
- func ReadCSVFilesSingleColumnValuesString(files []string, sep string, hasHeader, trimSpace bool, col uint, ...) ([]string, error)
- func ToDocuments(tbl *TableData) []map[string]interface{}
- func ToHTML(tbl *TableData, domID string, escapeHTML bool) string
- func WriteCSV(path string, t *TableData) error
- func WriteCSVSimple(cols []string, records [][]string, filename string) error
- func WriteXLSX(path string, tbls ...*TableData) error
- func WriteXLSXInterface(filename string, sheetdatas ...SheetData) error
- type DocumentsSet
- type DocumentsSetMeta
- type SheetData
- type TableData
- func NewTableData() TableData
- func NewTableDataFileCSV(path string, comma rune, stripBom bool) (TableData, error)
- func NewTableDataFileSimple(path string, sep string, hasHeader, trimSpace bool) (TableData, error)
- func NewTableDataFilesSimple(filenames []string, sep string, hasHeader, trimSpace bool) (TableData, error)
- func (t *TableData) ColIndex(colName string) int
- func (t *TableData) ColValuesByColName(colName string) ([]string, error)
- func (t *TableData) ColumnIndex(wantCol string) int
- func (t *TableData) ColumnValuesDistinct(wantCol string) (map[string]int, error)
- func (t *TableData) ColumnValuesMinMax(wantCol string) (string, string, error)
- func (t *TableData) ColumnsValuesDistinct(wantCols []string, stripSpace bool) (map[string]int, error)
- func (t *TableData) FilterRecords(wantColNameValues map[string]string) ([][]string, error)
- func (tbl *TableData) FormatterFunc() func(val string, colIdx uint) (interface{}, error)
- func (t *TableData) LoadMergedRows(data [][]string)
- func (t *TableData) NewTableFiltered(wantColNameValues map[string]string) (TableData, error)
- func (t *TableData) RecordToMSS(record []string) map[string]string
- func (t *TableData) RecordValue(wantCol string, record []string) (string, error)
- func (t *TableData) RecordValueOrEmpty(wantCol string, record []string) string
- func (t *TableData) ToSliceMSS() []map[string]string
- func (t *TableData) WriteCSV(path string) error
- func (t *TableData) WriteJSON(path string, perm os.FileMode, jsonPrefix, jsonIndent string) error
- func (t *TableData) WriteXLSX(path, sheetname string) error
- type TableSet
Constants ¶
View Source
const ( ExcelMaxColCount = 16384 ExcelMaxRowCount = 1048576 Alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" ZZ = uint32(702) ZZIndex = uint32(701) )
Variables ¶
View Source
var DebugReadCSV = false // should not need to use this.
Functions ¶
func ColIndexToLetters ¶
func ColNumberToLetters ¶
func CoordinateNumbersToSheetLocation ¶
CoordinateNumbersToSheetLocation converts x, y integer coordinates to a spreadsheet location such as "AA1" for col 27, row 1.
func CoordinatesToSheetLocation ¶
CoordinatesToSheetLocation converts x, y integer coordinates to a spreadsheet location such as "AA1" for col 27, row 1.
func FormatStringAndFloats ¶
func FormatStringAndInts ¶
func FormatStrings ¶
func FormatTimeAndFloats ¶
func FormatTimeAndInts ¶
func ToDocuments ¶
func WriteCSVSimple ¶
WriteCSVSimple writes a file with cols and records data.
func WriteXLSXInterface ¶
Types ¶
type DocumentsSet ¶
type DocumentsSet struct { Meta DocumentsSetMeta `json:"meta"` Documents []map[string]string `json:"records"` }
func NewDocumentsSet ¶
func NewDocumentsSet() DocumentsSet
func ReadMergeFilterCSVFiles ¶
func ReadMergeFilterCSVFiles(inPaths []string, outPath string, inComma rune, inStripBom bool, andFilter map[string]stringsutil.MatchInfo) (DocumentsSet, error)
func (*DocumentsSet) CreateHistogram ¶
func (ds *DocumentsSet) CreateHistogram(key string)
func (*DocumentsSet) Inflate ¶
func (ds *DocumentsSet) Inflate()
type DocumentsSetMeta ¶
type DocumentsSetMeta struct { Count int `json:"count"` Histograms map[string]histogram.Histogram `json:"histograms"` }
func NewDocumentsSetMeta ¶
func NewDocumentsSetMeta() DocumentsSetMeta
type TableData ¶ added in v1.0.0
type TableData struct { Name string Columns []string Records [][]string FormatMap map[int]string FormatFunc func(val string, colIdx uint) (interface{}, error) }
TableData is useful for working on CSV data
func NewTableData ¶ added in v1.0.0
func NewTableData() TableData
func NewTableDataFileCSV ¶ added in v1.1.0
NewTableDataFileCSV reads in a CSV file and returns a TableData struct.
func NewTableDataFileSimple ¶ added in v1.1.0
func NewTableDataFilesSimple ¶ added in v1.1.0
func (*TableData) ColValuesByColName ¶ added in v1.1.0
func (*TableData) ColumnIndex ¶ added in v1.0.0
func (*TableData) ColumnValuesDistinct ¶ added in v1.0.0
func (*TableData) ColumnValuesMinMax ¶ added in v1.0.0
func (*TableData) ColumnsValuesDistinct ¶ added in v1.0.0
func (*TableData) FilterRecords ¶ added in v1.0.0
func (*TableData) FormatterFunc ¶ added in v1.1.0
func (*TableData) LoadMergedRows ¶ added in v1.0.0
func NewTableDataCSV(path string, comma rune, stripBom bool) (TableData, error) { tbl := NewTableData() csv, file, err := csvutil.NewReader(path, comma, stripBom) if err != nil { return tbl, err } defer file.Close() mergedRows, err := csv.ReadAll() if err != nil { return tbl, err } tbl.LoadMergedRows(mergedRows) return tbl, nil }
LoadMergedRows is used to load data from `[][]string` sources like csv.ReadAll()
func (*TableData) NewTableFiltered ¶ added in v1.0.0
func (*TableData) RecordToMSS ¶ added in v1.0.0
func (*TableData) RecordValue ¶ added in v1.0.0
func (*TableData) RecordValueOrEmpty ¶ added in v1.0.0
func (*TableData) ToSliceMSS ¶ added in v1.0.0
Click to show internal directories.
Click to hide internal directories.