csvdriver

package
v0.34.1 Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2023 License: BSD-3-Clause Imports: 14 Imported by: 15

Documentation

Overview

package csvdriver registers a database/sql/driver.Driver implementation for CSV files.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Create

func Create(name string) (*sql.DB, error)

Create is a CSV-driver helper function for sql.Open.

It creates a new CSV file, connected via the csvdriver.

func Open

func Open(name string) (*sql.DB, error)

Open is a CSV-driver helper function for sql.Open.

It opens a database connection to csvdriver.

Types

type Conn

type Conn struct {
	File    string      `json:"file"`    // name of the file to be open
	Mode    int         `json:"mode"`    // r/w mode (default: read-only)
	Perm    os.FileMode `json:"perm"`    // file permissions
	Comma   rune        `json:"comma"`   // field delimiter (default: ',')
	Comment rune        `json:"comment"` // comment character for start of line (default: '#')
	Header  bool        `json:"header"`  // whether the CSV-file has a column header
	Names   []string    `json:"names"`   // column names
}

Conn describes how a connection to the CSV-driver should be established.

func (Conn) Open

func (c Conn) Open() (*sql.DB, error)

Open opens a database connection with the CSV driver.

Jump to

Keyboard shortcuts

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