Documentation ¶
Overview ¶
Package file implements a framework for file input and output streams, which can be used for all types of two-dimensional table file input and output
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RegisterCreator ¶
RegisterCreator - Registers an output stream creator with the given name 'name'.
func RegisterOpener ¶
RegisterOpener - Registers an input stream opener with the given name 'name'
func UnregisterAllCreater ¶
func UnregisterAllCreater()
UnregisterAllCreater - Unregister all file openers.
func UnregisterAllOpener ¶
func UnregisterAllOpener()
UnregisterAllOpener - Unregisters all file openers
Types ¶
type Creator ¶
type Creator interface {
Create(filename string) (stream OutStream, err error) // Create an output stream named 'filename'.
}
Creator - The creator that generates the output stream.
type FetchHandler ¶
type FetchHandler interface { OnRecord(element.Record) error // Process Record - Handles the record CreateRecord() (element.Record, error) // Create Empty Record - Creates an empty record }
FetchHandler - Acquires the record handler
type InStream ¶
type InStream interface { Rows(conf *config.JSON) (rows Rows, err error) // Get Line Reader - Acquires a line reader Close() (err error) // Close Input Stream - Closes the input stream }
InStream - Input stream
type InStreamer ¶
type InStreamer struct {
// contains filtered or unexported fields
}
InStreamer - Input stream wrapper
func NewInStreamer ¶
func NewInStreamer(name string, filename string) (streamer *InStreamer, err error)
NewInStreamer - Opens an input stream named 'filename' using the input stream opener with the given 'name'
func (*InStreamer) Read ¶
func (s *InStreamer) Read(ctx context.Context, conf *config.JSON, handler FetchHandler) (err error)
Read - Reads data using the record handler 'handler', context 'ctx', and configuration file 'conf'
type Opener ¶
type Opener interface {
Open(filename string) (stream InStream, err error) // Open Input Stream - Opens an input stream for the file named 'filename'
}
Opener - An opener used to open an input stream
type OutStream ¶
type OutStream interface { Writer(conf *config.JSON) (writer StreamWriter, err error) // Create a writer for writing to the output stream. Close() (err error) // Close the output stream. }
OutStream - Represents the output stream.
type OutStreamer ¶
type OutStreamer struct {
// contains filtered or unexported fields
}
OutStreamer - A wrapper for the output stream.
func NewOutStreamer ¶
func NewOutStreamer(name string, filename string) (streamer *OutStreamer, err error)
NewOutStreamer - Opens an output stream named 'filename' using the creator with the given name 'name'.
func (*OutStreamer) Writer ¶
func (s *OutStreamer) Writer(conf *config.JSON) (StreamWriter, error)
Writer - Creates a stream writer based on the configuration 'conf'.
type Rows ¶
type Rows interface { Next() bool // Get Next Line - Returns true if there is a next line, false otherwise Scan() (columns []element.Column, err error) // Scan Columns - Scans the columns of each line Error() error // Get Error of Next Line - Gets the error of the next line Close() error // Close Line Reader - Closes the line reader }
Rows - Line reader
Directories ¶
Path | Synopsis |
---|---|
Package compress mainly implements compression methods.
|
Package compress mainly implements compression methods. |
Package csv mainly implements the stream/file interface.
|
Package csv mainly implements the stream/file interface. |
Package xlsx mainly implements the stream/file interface.
|
Package xlsx mainly implements the stream/file interface. |