sqimport

package
v1.0.35 Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2021 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

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 {
	sync.Mutex
	// contains filtered or unexported fields
}

func DefaultImporter

func DefaultImporter(url string, writer SQWriter) (*Importer, error)

Create an importer with default configuation

func NewImporter

func NewImporter(c SQImportConfig, u string, writer SQWriter) (*Importer, error)

Create a new importer with a database writer

func (*Importer) Decoder

func (this *Importer) Decoder(mimetype string) (SQImportDecoder, error)

Return a new decoder for the given mimetype

func (*Importer) Name

func (this *Importer) Name() string

func (*Importer) NewCSVDecoder

func (this *Importer) NewCSVDecoder(r io.Reader, delimiter rune) (SQImportDecoder, error)

NewCSVDecoder returns a CSV decoder setting options

func (*Importer) ReadWrite

func (this *Importer) ReadWrite() error

Read a row from the source data and potentially insert into the table. On end of data, returns io.EOF.

func (*Importer) URL

func (this *Importer) URL() *url.URL

type SQLWriter

type SQLWriter struct {
	*sqlite3.ConnEx
	// contains filtered or unexported fields
}

func NewSQLWriter

func NewSQLWriter(c SQImportConfig, db *sqlite3.ConnEx) (*SQLWriter, error)

func (*SQLWriter) Begin

func (this *SQLWriter) Begin(name, schema string, cols []string) (WriterFunc, error)

Begin a transaction, passing a writing function back to the caller

func (*SQLWriter) End

func (this *SQLWriter) End(success bool) error

type WriterFunc

type WriterFunc func(row []interface{}) error

Jump to

Keyboard shortcuts

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