csvload

package
v0.4.12 Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2023 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Unknown = Type(0)
	String  = Type(1)
	Int     = Type(2)
	Float   = Type(3)
	Date    = Type(4)
)
View Source
const DefaultChunkSize = 1024

Variables

View Source
var (
	DateFormat = "2006-01-02 15:04:05"

	ErrTooManyFields = errors.New("too many fields")
)

Functions

This section is empty.

Types

type Column

type Column struct {
	Name             string
	DataType         string
	Length           int
	Precision, Scale int
	Type             Type
	Nullable         bool
}

func CreateTable

func CreateTable(ctx context.Context, db *sql.DB, tbl string, rows <-chan dbcsv.Row, truncate bool, tablespace, copyTable string, forceString bool, logger *slog.Logger) ([]Column, error)

func (Column) FromString

func (c Column) FromString(ss []string) (interface{}, error)

type Config

type Config struct {
	Tablespace, Copy string
	*dbcsv.Config
	JustPrint              io.Writer
	Logger                 *slog.Logger
	Concurrency, ChunkSize int
	ForceString, Truncate  bool
	LobSource              bool
}

func (Config) Close

func (cfg Config) Close() error

func (Config) Load

func (cfg Config) Load(ctx context.Context, db *sql.DB, tbl, src string, fields []string) error

func (Config) Open

func (cfg Config) Open(ctx context.Context, db *sql.DB, fn string) (err error)

type Type

type Type uint8

func (Type) String

func (t Type) String() string

Jump to

Keyboard shortcuts

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