Documentation
¶
Index ¶
- Variables
- type Importer
- func (this *Importer) Decoder(mimetype string) (SQImportDecoder, error)
- func (i *Importer) Name() string
- func (this *Importer) NewCSVDecoder(c io.Closer, r io.Reader, delimiter rune) (SQImportDecoder, error)
- func (this *Importer) NewXLSDecoder(r io.Reader) (SQImportDecoder, error)
- func (i *Importer) ReadWrite(dec SQImportDecoder) error
- func (i *Importer) URL() *url.URL
- type SQImportWriter
- type SQImportWriterFunc
- type SQLWriter
Constants ¶
This section is empty.
Variables ¶
View Source
var ( DefaultConfig = SQImportConfig{ Header: true, TrimSpace: true, LazyQuotes: true, } )
Functions ¶
This section is empty.
Types ¶
type Importer ¶
type Importer struct {
// contains filtered or unexported fields
}
func DefaultImporter ¶
func DefaultImporter(url string, w SQImportWriter) (*Importer, error)
Create an importer with default configuation
func NewImporter ¶
func NewImporter(c SQImportConfig, u string, w SQImportWriter) (*Importer, error)
Create a new importer with a database writer
func (*Importer) Decoder ¶
Return a new decoder for the given mimetype, or guess the mimetype when opening the file
func (*Importer) NewCSVDecoder ¶
func (this *Importer) NewCSVDecoder(c io.Closer, r io.Reader, delimiter rune) (SQImportDecoder, error)
NewCSVDecoder returns a CSV decoder setting options
func (*Importer) NewXLSDecoder ¶
NewXLSDecoder returns a XLS decoder setting options
type SQImportWriter ¶
type SQImportWriter interface { // Begin the writer process for a destination and return a writer callback Begin(name, schema string, cols []string) (SQImportWriterFunc, error) // End the transaction with success (true) or failure (false). On failure, rollback End(bool) error }
SQImportWriter is an interface for writing decoded rows to a destination
type SQImportWriterFunc ¶
type SQImportWriterFunc func([]interface{}) error
SQWriterFunc callback invoked for each row
Click to show internal directories.
Click to hide internal directories.