tablet

package
v0.0.0-...-3712671 Latest Latest
Warning

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

Go to latest
Published: Jul 28, 2014 License: BSD-3-Clause Imports: 13 Imported by: 0

Documentation

Overview

API compliant to the requirements of database/sql Open expects name to be "hostname:port/keyspace/shard" For query arguments, we assume place-holders in the query string in the form of :v0, :v1, etc.

This implements some additional error handling logic to make the client more robust in the face of transient problems with easy solutions.

Index

Constants

View Source
const (
	ErrTypeFatal = 1 //errors.New("vt: fatal: reresolve endpoint")
	ErrTypeRetry = 2 //errors.New("vt: retry: reconnect endpoint")
	ErrTypeApp   = 3 //errors.New("vt: app level error")
)
View Source
const (
	DefaultReconnectDelay = 2 * time.Millisecond
	DefaultMaxAttempts    = 2
	DefaultTimeout        = 30 * time.Second
)

Variables

View Source
var (
	ErrNoNestedTxn         = errors.New("vt: no nested transactions")
	ErrBadCommit           = errors.New("vt: commit without corresponding begin")
	ErrBadRollback         = errors.New("vt: rollback without corresponding begin")
	ErrNoLastInsertId      = errors.New("vt: no LastInsertId available after streaming statement")
	ErrNoRowsAffected      = errors.New("vt: no RowsAffected available after streaming statement")
	ErrFieldLengthMismatch = errors.New("vt: no RowsAffected available after streaming statement")
)

Functions

This section is empty.

Types

type Conn

type Conn struct {
	TransactionId int64
	// contains filtered or unexported fields
}

Not thread safe, as per sql package.

func DialTablet

func DialTablet(dbi string, stream bool, timeout time.Duration) (conn *Conn, err error)

func (*Conn) Begin

func (conn *Conn) Begin() (db.Tx, error)

func (*Conn) Close

func (conn *Conn) Close() error

func (*Conn) Commit

func (conn *Conn) Commit() error

func (*Conn) Exec

func (conn *Conn) Exec(query string, bindVars map[string]interface{}) (db.Result, error)

func (*Conn) Rollback

func (conn *Conn) Rollback() error

type Result

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

func NewResult

func NewResult(rowCount, rowsAffected, insertId int64, fields []mproto.Field) *Result

func (*Result) Close

func (result *Result) Close() error

func (*Result) Columns

func (result *Result) Columns() []string

driver.Rows interface

func (*Result) Err

func (result *Result) Err() error

func (*Result) Fields

func (result *Result) Fields() []mproto.Field

FIXME(msolomon) This should be intependent of the mysql module.

func (*Result) LastInsertId

func (result *Result) LastInsertId() (int64, error)

func (*Result) Next

func (result *Result) Next() (row []interface{})

func (*Result) Rows

func (result *Result) Rows() [][]sqltypes.Value

func (*Result) RowsAffected

func (result *Result) RowsAffected() (int64, error)

func (*Result) RowsRetrieved

func (result *Result) RowsRetrieved() int64

type StreamResult

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

func (*StreamResult) Close

func (*StreamResult) Close() error

func (*StreamResult) Columns

func (sr *StreamResult) Columns() (cols []string)

driver.Rows interface

func (*StreamResult) Err

func (sr *StreamResult) Err() error

func (*StreamResult) LastInsertId

func (*StreamResult) LastInsertId() (int64, error)

driver.Result interface

func (*StreamResult) Next

func (sr *StreamResult) Next() (row []interface{})

func (*StreamResult) RowsAffected

func (*StreamResult) RowsAffected() (int64, error)

type TabletError

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

func (TabletError) Error

func (te TabletError) Error() string

type Tx

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

func (*Tx) Commit

func (tx *Tx) Commit() error

driver.Tx interface (forwarded to Conn)

func (*Tx) Rollback

func (tx *Tx) Rollback() error

type VtConn

type VtConn struct {
	Conn
	// contains filtered or unexported fields
}

func DialVtdb

func DialVtdb(dbi string, stream bool, timeout time.Duration) (*VtConn, error)

func (*VtConn) Begin

func (vtc *VtConn) Begin() (db.Tx, error)

func (*VtConn) Commit

func (vtc *VtConn) Commit() (err error)

func (*VtConn) Exec

func (vtc *VtConn) Exec(query string, bindVars map[string]interface{}) (db.Result, error)

Jump to

Keyboard shortcuts

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