driver

package
v0.0.0-...-d626351 Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2020 License: ISC Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DRIVER_ERROR  = "driver"
	MONETDB_ERROR = "monetdb"
	NETWORK_ERROR = "network"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// includes host:port, makes handling redirects easier
	Host     string
	UserName string
	Password string
	Database string
	Schema   string
	Role     string
}

type Conn

type Conn struct {
	net.Conn
	// contains filtered or unexported fields
}

func Open

func Open(config Config) (Conn, error)

func (Conn) PrepareRow

func (c Conn) PrepareRow(sql string, values ...interface{}) ([]string, error)

func (Conn) PrepareRows

func (c Conn) PrepareRows(sql string, values ...interface{}) ([][]string, error)

func (Conn) QueryRow

func (c Conn) QueryRow(sql string) ([]string, error)

func (Conn) QueryRows

func (c Conn) QueryRows(sql string) ([][]string, error)

func (Conn) ReadFrame

func (c Conn) ReadFrame() ([]byte, bool, error)

Exposed since we want to be able to "stream" the output using various transformers (raw, expanded, ...) Note that the buffer remains owned by the connection - callers should copy it if they need it to survive the next call to ReadFrame (or any other calls involving the connection)

func (Conn) ReadResult

func (c Conn) ReadResult() (Result, error)

func (Conn) Send

func (c Conn) Send(parts ...string) error

type EmptyResult

type EmptyResult struct{ SimpleResult }

func (EmptyResult) IsSimple

func (r EmptyResult) IsSimple() (bool, string)

type Error

type Error struct {
	Source  string
	Message string
	Details string
	Inner   error
}

func (Error) Error

func (e Error) Error() string

type Meta

type Meta struct {
	RowCount int
	SqlTime  int
	OptTime  int
	RunTime  int
}

func NewMeta

func NewMeta(data []byte) *Meta

exposed this way so that all outputs (including raw and trash) can use it

type OKResult

type OKResult struct{ SimpleResult }

func (OKResult) IsSimple

func (r OKResult) IsSimple() (bool, string)

type PrepareResult

type PrepareResult struct {
	SimpleResult
	// contains filtered or unexported fields
}

func (PrepareResult) IsSimple

func (r PrepareResult) IsSimple() (bool, string)

type QueryResult

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

TODO: this should probably be an interface that can return data based on the type of result.

func (*QueryResult) Columns

func (r *QueryResult) Columns() []string

func (*QueryResult) IsSimple

func (r *QueryResult) IsSimple() (bool, string)

func (*QueryResult) Lengths

func (r *QueryResult) Lengths() []int

func (*QueryResult) Maps

func (r *QueryResult) Maps() ([]map[string]string, error)

func (*QueryResult) Meta

func (r *QueryResult) Meta() *Meta

func (*QueryResult) Next

func (r *QueryResult) Next() ([][]string, error)

func (*QueryResult) Rows

func (r *QueryResult) Rows() ([][]string, error)

func (*QueryResult) Types

func (r *QueryResult) Types() []string

type Result

type Result interface {
	Types() []string
	Columns() []string
	Lengths() []int
	Meta() *Meta
	Next() ([][]string, error)
	IsSimple() (bool, string)
	Rows() ([][]string, error)
	Maps() ([]map[string]string, error)
}

type SimpleResult

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

func (SimpleResult) Columns

func (_ SimpleResult) Columns() []string

func (SimpleResult) Lengths

func (_ SimpleResult) Lengths() []int

func (SimpleResult) Maps

func (_ SimpleResult) Maps() ([]map[string]string, error)

func (SimpleResult) Meta

func (r SimpleResult) Meta() *Meta

func (SimpleResult) Next

func (_ SimpleResult) Next() ([][]string, error)

func (SimpleResult) Rows

func (_ SimpleResult) Rows() ([][]string, error)

func (SimpleResult) Types

func (_ SimpleResult) Types() []string

Jump to

Keyboard shortcuts

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