db

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2018 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cell

type Cell struct {
	Value string
}

type Column

type Column struct {
	Name string
	Type Type
}

type DataSource

type DataSource struct {
	Dialect
	*sql.DB
}

func NewDataSource

func NewDataSource(source string) (ds *DataSource, err error)

func (*DataSource) Close

func (ds *DataSource) Close()

Close closes the connection to the data source

func (*DataSource) CreateDBIfNotExist

func (ds *DataSource) CreateDBIfNotExist() error

func (*DataSource) Query

func (ds *DataSource) Query(input Input) (qr QueryResult, err error)

func (*DataSource) Tables

func (ds *DataSource) Tables() (names []string, err error)

Tables returns the names of the available tables in the data source

type DataSources

type DataSources map[string]*DataSource

func NewDataSources

func NewDataSources(sources []string) (dataSources DataSources, err error)

func (DataSources) Close

func (dataSources DataSources) Close()

type Dialect

type Dialect interface {
	TablesQuery() string
	ExtractCellInfo(interface{}) (Cell, Type)
	ConnectionString() string
	DBName() string
	IsUnknown(error) bool
	DriverName() string
}

func NewDialect

func NewDialect(u *url.URL) (Dialect, error)

type Input added in v0.3.0

type Input struct {
	Query     string
	Variables []query.Variable
}

type MySQL

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

func NewMySQLDialect

func NewMySQLDialect(u *url.URL) (*MySQL, error)

func (*MySQL) ConnectionString

func (my *MySQL) ConnectionString() string

func (*MySQL) DBName

func (my *MySQL) DBName() string

func (*MySQL) DriverName

func (*MySQL) DriverName() string

func (*MySQL) ExtractCellInfo

func (my *MySQL) ExtractCellInfo(data interface{}) (cell Cell, colType Type)

func (*MySQL) IsUnknown

func (my *MySQL) IsUnknown(e error) bool

func (*MySQL) TablesQuery

func (my *MySQL) TablesQuery() string

type Postgres

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

func NewPostgresDialect

func NewPostgresDialect(u *url.URL) (*Postgres, error)

func (*Postgres) ConnectionString

func (pg *Postgres) ConnectionString() string

func (*Postgres) DBName

func (pg *Postgres) DBName() string

func (*Postgres) DriverName

func (pg *Postgres) DriverName() string

func (*Postgres) ExtractCellInfo

func (pg *Postgres) ExtractCellInfo(data interface{}) (cell Cell, colType Type)

func (*Postgres) IsUnknown

func (pg *Postgres) IsUnknown(e error) bool

func (*Postgres) TablesQuery

func (pg *Postgres) TablesQuery() string

type QueryResult

type QueryResult struct {
	Rows    []Row
	Columns []Column
}

type Row

type Row []Cell

type Type

type Type int
const (
	UnknownType Type = iota
	Number
	Text
	Time
)

func (Type) String

func (i Type) String() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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