Documentation ¶
Overview ¶
Package grate opens tabular data files (such as spreadsheets and delimited plaintext files) and allows programmatic access to the data contents in a consistent interface.
Index ¶
Constants ¶
const ( // ContinueColumnMerged marks a continuation column within a merged cell. ContinueColumnMerged = "→" // EndColumnMerged marks the last column of a merged cell. EndColumnMerged = "⇥" // ContinueRowMerged marks a continuation row within a merged cell. ContinueRowMerged = "↓" // EndRowMerged marks the last row of a merged cell. EndRowMerged = "⤓" )
Variables ¶
var ( // Debug should be set to true to expose detailed logging. Debug bool = (loglevel == "debug") )
var ErrInvalidScanType = errors.New("grate: Scan only supports *bool, *int, *float64, *string, *time.Time arguments")
ErrInvalidScanType is returned by Scan for invalid arguments.
var ErrNotInFormat = errors.New("grate: file is not in this format")
ErrNotInFormat is used to auto-detect file types using the defined OpenFunc It is returned by OpenFunc when the code does not detect correct file formats.
var ErrUnknownFormat = errors.New("grate: file format is not known/supported")
ErrUnknownFormat is used when grate does not know how to open a file format.
Functions ¶
Types ¶
type Collection ¶
type Collection interface { // Next advances to the next record of content. // It MUST be called prior to any Scan(). Next() bool // Strings extracts values from the current record into a list of strings. Strings() []string // Scan extracts values from the current record into the provided arguments // Arguments must be pointers to one of 5 supported types: // bool, int64, float64, string, or time.Time // If invalid, returns ErrInvalidScanType Scan(args ...interface{}) error // IsEmpty returns true if there are no data values. IsEmpty() bool // Err returns the last error that occured. Err() error }
Collection represents an iterable collection of records.
type OpenFunc ¶
OpenFunc defines a Source's instantiation function. It should return ErrNotInFormat immediately if filename is not of the correct file type.
type Source ¶
type Source interface { // List the individual data tables within this source. List() ([]string, error) // Get a Collection from the source by name. Get(name string) (Collection, error) // Close the source and discard memory. Close() error }
Source represents a set of data collections.
Directories ¶
Path | Synopsis |
---|---|
cmd
|
|
grate2tsv
Command grate2tsv is a highly parallel tabular data extraction tool.
|
Command grate2tsv is a highly parallel tabular data extraction tool. |
grater
Command grater extracts contents of the tabular files to stdout.
|
Command grater extracts contents of the tabular files to stdout. |
Package xls implements the Microsoft Excel Binary File Format (.xls) Structure.
|
Package xls implements the Microsoft Excel Binary File Format (.xls) Structure. |
cfb
Package cfb implements the Microsoft Compound File Binary File Format.
|
Package cfb implements the Microsoft Compound File Binary File Format. |
crypto
Package crypto implements excel encryption algorithms from the MS-OFFCRYPTO design specs.
|
Package crypto implements excel encryption algorithms from the MS-OFFCRYPTO design specs. |