voltdb

package
v0.0.0-...-4328e4c Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2016 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Conn

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

Conn is a single connection to a single node of a VoltDB database

func NewConnection

func NewConnection(user string, passwd string, hostAndPort string) (*Conn, error)

NewConn creates an initialized, authenticated Conn.

func (*Conn) Call

func (conn *Conn) Call(procedure string, params ...interface{}) (*Response, error)

Call invokes the procedure 'procedure' with parameter values 'params' and returns a pointer to the received Response.

func (*Conn) Close

func (conn *Conn) Close() error

Close a connection if open. A Conn, once closed, has no further use. To open a new connection, use NewConnection.

func (*Conn) GoString

func (conn *Conn) GoString() string

GoString provides a default printable format for Conn.

func (*Conn) Query

func (conn *Conn) Query(procedure string, params ...interface{}) (*Query, error)

Like Call, but return a Call header response rather than a full response. Keeps connection open to read the rest at your leisure.

func (*Conn) TestConnection

func (conn *Conn) TestConnection() bool

Ping the database for liveness.

type Iterator

type Iterator struct {
	Err error
	// contains filtered or unexported fields
}

Iterator iterates over each row in a Query response.

func (*Iterator) All

func (iter *Iterator) All(result interface{}) error

Read all items from an Iterator until the query response ends. Expects a *[]struct{} as a parameter. Will panic if interface{} passed in is not a slice. Automatically closes the iterator once the end of the Query response is reached.

func (*Iterator) Next

func (iter *Iterator) Next(row interface{}) bool

Read an individual row from an iterator and store it in the struct passed in. Will return true for as long as there is a next value available in the iterator so that it can be called using 'for iterator.Next(&struct{}) {}'. Automatically closes the iterator once the end of the Query response is reached.

type Query

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

Query wraps Response and keeps the connection reader open to read at your own pace.

func (*Query) Iter

func (q *Query) Iter(bufferSize int) *Iterator

Create an Iterator with a set bufferSize. The iterator will read bufferSize rows from the TCP connection and then wait before reading any more until the buffer is drained.

type Response

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

Response is a stored procedure result.

func (*Response) AppStatus

func (rsp *Response) AppStatus() int

func (*Response) AppStatusString

func (rsp *Response) AppStatusString() string

func (*Response) ClusterLatency

func (rsp *Response) ClusterLatency() int

func (*Response) GoString

func (rsp *Response) GoString() string

func (*Response) ResultSets

func (rsp *Response) ResultSets() []Table

func (*Response) Status

func (rsp *Response) Status() Status

func (*Response) StatusString

func (rsp *Response) StatusString() string

func (*Response) Table

func (rsp *Response) Table(offset int) *Table

type Status

type Status int

Response status codes

const (
	SUCCESS            Status = 1
	USER_ABORT         Status = -1
	GRACEFUL_FAILURE   Status = -2
	UNEXPECTED_FAILURE Status = -3
	CONNECTION_LOST    Status = -4
)

func (Status) String

func (s Status) String() string

type Table

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

Table represents a single result set for a stored procedure invocation.

func (*Table) ColumnCount

func (table *Table) ColumnCount() int

func (*Table) ColumnNames

func (table *Table) ColumnNames() []string

func (*Table) ColumnTypes

func (table *Table) ColumnTypes() []int8

func (*Table) GoString

func (table *Table) GoString() string

func (*Table) HasNext

func (table *Table) HasNext() bool

HasNext returns true of there are additional rows to read.

func (*Table) Next

func (table *Table) Next(v interface{}) error

Next populates v (*struct) with the values of the next row.

func (*Table) RowCount

func (table *Table) RowCount() int

Rowcount returns the number of rows returned by the server for this table.

func (*Table) StatusCode

func (table *Table) StatusCode() int

Jump to

Keyboard shortcuts

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