mysql

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 10, 2019 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package mysql implements the mysql persistence interface of the csv2table package This file holds mysql escape routines

Package mysql implements the mysql persistence interface of the csv2table package

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ColumnMapping

type ColumnMapping struct {
	Type        string
	Index       bool
	Format      string
	NullIf      []string
	NullIfEmpty bool
}

ColumnMapping holds configuration of a csv column

type Config

type Config struct {
	Db       string
	Host     string // db host
	Port     int    // db port
	Username string // db username
	Password string // db password

	Table      string                   // table name
	Mapping    map[string]ColumnMapping // columns mapping
	ColumnType map[string]string        // kind of columns type as understood by us (internal)

	Drop     bool // drop table if already exists?
	Truncate bool // truncate table before insert?
	AutoPk   bool // use auto increment primary key?

	DefaultColType string // column type definintion
	TableOptions   string // default table options
	BulkInsertSize int    // how many rows to insert at once

	Verbose bool // whether to log various exection steps

	Email csv2table.Email
}

Config holds mysql specific configuration

type DbService

type DbService struct {
	// contains filtered or unexported fields
}

DbService represents a service that implements csv2table.DbService for mysql

func NewService

func NewService() *DbService

NewService creates a new instance of the DbService

func (*DbService) End

func (s *DbService) End() error

End finishes the processing of a csv2table.CsvFile

func (*DbService) ProcessHeader

func (s *DbService) ProcessHeader(header []string) error

ProcessHeader is called to process the header, after Start() and before first call of ProcessLine()

func (*DbService) ProcessLine

func (s *DbService) ProcessLine(line []string) error

ProcessLine processes a line header of the csv file

func (*DbService) Start

func (s *DbService) Start(fileName string, v *viper.Viper) error

Start initializes the processing of a csv file

Jump to

Keyboard shortcuts

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