driver

package
v0.0.0-...-4b82dee Latest Latest
Warning

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

Go to latest
Published: Sep 6, 2015 License: Apache-2.0 Imports: 20 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package driver is a generated protocol buffer package.

It is generated from these files:

cockroach/sql/driver/wire.proto

It has these top-level messages:

Datum
Result
Request
Response

Index

Constants

View Source
const (
	// Endpoint is the URL path prefix which accepts incoming
	// HTTP requests for the SQL API.
	Endpoint = "/sql/"
)
View Source
const (
	// StatusTooManyRequests indicates client should retry due to
	// server having too many requests.
	StatusTooManyRequests = 429
)

Variables

View Source
var (
	ErrInvalidLengthWire = fmt.Errorf("proto: negative length found during unmarshaling")
)

Functions

func RegisterSender

func RegisterSender(scheme string, f NewSenderFunc)

RegisterSender registers the specified function to be used for creation of a new sender when the specified scheme is encountered.

Types

type Datum

type Datum struct {
	BoolVal   *bool            `protobuf:"varint,1,opt,name=bool_val" json:"bool_val,omitempty"`
	IntVal    *int64           `protobuf:"varint,2,opt,name=int_val" json:"int_val,omitempty"`
	FloatVal  *float64         `protobuf:"fixed64,3,opt,name=float_val" json:"float_val,omitempty"`
	BytesVal  []byte           `protobuf:"bytes,4,opt,name=bytes_val" json:"bytes_val,omitempty"`
	StringVal *string          `protobuf:"bytes,5,opt,name=string_val" json:"string_val,omitempty"`
	TimeVal   *Datum_Timestamp `protobuf:"bytes,6,opt,name=time_val" json:"time_val,omitempty"`
}

func (*Datum) GetBoolVal

func (m *Datum) GetBoolVal() bool

func (*Datum) GetBytesVal

func (m *Datum) GetBytesVal() []byte

func (*Datum) GetFloatVal

func (m *Datum) GetFloatVal() float64

func (*Datum) GetIntVal

func (m *Datum) GetIntVal() int64

func (*Datum) GetStringVal

func (m *Datum) GetStringVal() string

func (*Datum) GetTimeVal

func (m *Datum) GetTimeVal() *Datum_Timestamp

func (*Datum) GetValue

func (this *Datum) GetValue() interface{}

func (*Datum) Marshal

func (m *Datum) Marshal() (data []byte, err error)

func (*Datum) MarshalTo

func (m *Datum) MarshalTo(data []byte) (int, error)

func (*Datum) ProtoMessage

func (*Datum) ProtoMessage()

func (*Datum) Reset

func (m *Datum) Reset()

func (*Datum) SetValue

func (this *Datum) SetValue(value interface{}) bool

func (*Datum) Size

func (m *Datum) Size() (n int)

func (Datum) String

func (d Datum) String() string

func (*Datum) Unmarshal

func (m *Datum) Unmarshal(data []byte) error

type Datum_Timestamp

type Datum_Timestamp struct {
	// The time in seconds since, January 1, 1970 UTC (Unix time).
	Sec int64 `protobuf:"varint,1,opt,name=sec" json:"sec"`
	// nsec specifies a non-negative nanosecond offset within sec.
	// It must be in the range [0, 999999999].
	Nsec uint32 `protobuf:"varint,2,opt,name=nsec" json:"nsec"`
}

Timestamp represents an absolute timestamp devoid of time-zone.

func (*Datum_Timestamp) GetNsec

func (m *Datum_Timestamp) GetNsec() uint32

func (*Datum_Timestamp) GetSec

func (m *Datum_Timestamp) GetSec() int64

func (*Datum_Timestamp) Marshal

func (m *Datum_Timestamp) Marshal() (data []byte, err error)

func (*Datum_Timestamp) MarshalTo

func (m *Datum_Timestamp) MarshalTo(data []byte) (int, error)

func (*Datum_Timestamp) ProtoMessage

func (*Datum_Timestamp) ProtoMessage()

func (*Datum_Timestamp) Reset

func (m *Datum_Timestamp) Reset()

func (*Datum_Timestamp) Size

func (m *Datum_Timestamp) Size() (n int)

func (*Datum_Timestamp) String

func (m *Datum_Timestamp) String() string

func (*Datum_Timestamp) Unmarshal

func (m *Datum_Timestamp) Unmarshal(data []byte) error

type Method

type Method int

Method is the enumerated type for methods.

const (
	// Execute runs all the sql statements in a SQLRequest and
	// returns a SQLResponse.
	Execute Method = iota
)

func (Method) String

func (i Method) String() string

type NewSenderFunc

type NewSenderFunc func(u *url.URL, ctx *base.Context, retryOpts retry.Options) (Sender, error)

NewSenderFunc creates a new sender for the registered scheme.

type Request

type Request struct {
	// User is the originating user.
	User string `protobuf:"bytes,1,opt,name=user" json:"user"`
	// Session settings that were returned in the last response that
	// contained them, being reflected back to the server.
	Session []byte `protobuf:"bytes,2,opt,name=session" json:"session,omitempty"`
	// SQL statement(s) to be serially executed by the server. Multiple
	// statements are passed as a single string separated by semicolons.
	Sql string `protobuf:"bytes,3,opt,name=sql" json:"sql"`
	// Parameters referred to in the above SQL statement(s) using "?".
	Params []Datum `protobuf:"bytes,4,rep,name=params" json:"params"`
}

An SQL request to cockroach. A transaction can consist of multiple requests.

func (Request) CreateReply

func (Request) CreateReply() Response

CreateReply creates an empty response for the request.

func (*Request) GetParams

func (m *Request) GetParams() []Datum

func (*Request) GetSession

func (m *Request) GetSession() []byte

func (*Request) GetSql

func (m *Request) GetSql() string

func (*Request) GetUser

func (m *Request) GetUser() string

func (*Request) Marshal

func (m *Request) Marshal() (data []byte, err error)

func (*Request) MarshalTo

func (m *Request) MarshalTo(data []byte) (int, error)

func (Request) Method

func (Request) Method() Method

Method returns the method.

func (*Request) ProtoMessage

func (*Request) ProtoMessage()

func (*Request) Reset

func (m *Request) Reset()

func (*Request) Size

func (m *Request) Size() (n int)

func (*Request) String

func (m *Request) String() string

func (*Request) Unmarshal

func (m *Request) Unmarshal(data []byte) error

type Response

type Response struct {
	// Setting that should be reflected back in all subsequent requests.
	// When not set, future requests should continue to use existing settings.
	Session []byte `protobuf:"bytes,1,opt,name=session" json:"session,omitempty"`
	// The list of results. There is one result object per SQL statement in the
	// request.
	Results []Result `protobuf:"bytes,2,rep,name=results" json:"results"`
}

func (*Response) GetResults

func (m *Response) GetResults() []Result

func (*Response) GetSession

func (m *Response) GetSession() []byte

func (*Response) Marshal

func (m *Response) Marshal() (data []byte, err error)

func (*Response) MarshalTo

func (m *Response) MarshalTo(data []byte) (int, error)

func (*Response) ProtoMessage

func (*Response) ProtoMessage()

func (*Response) Reset

func (m *Response) Reset()

func (*Response) Size

func (m *Response) Size() (n int)

func (*Response) String

func (m *Response) String() string

func (*Response) Unmarshal

func (m *Response) Unmarshal(data []byte) error

type Result

type Result struct {
	// Error is non-nil if an error occurred while executing the statement.
	Error *cockroach_proto2.Error `protobuf:"bytes,1,opt,name=error" json:"error,omitempty"`
	// The names of the columns returned in the result set in the order specified
	// in the SQL statement. The number of columns will equal the number of
	// values in each Row.
	Columns []string `protobuf:"bytes,2,rep,name=columns" json:"columns,omitempty"`
	// The rows in the result set.
	Rows []Result_Row `protobuf:"bytes,3,rep,name=rows" json:"rows"`
}

A Result is a collection of rows.

func (*Result) GetColumns

func (m *Result) GetColumns() []string

func (*Result) GetError

func (m *Result) GetError() *cockroach_proto2.Error

func (*Result) GetRows

func (m *Result) GetRows() []Result_Row

func (*Result) Marshal

func (m *Result) Marshal() (data []byte, err error)

func (*Result) MarshalTo

func (m *Result) MarshalTo(data []byte) (int, error)

func (*Result) ProtoMessage

func (*Result) ProtoMessage()

func (*Result) Reset

func (m *Result) Reset()

func (*Result) Size

func (m *Result) Size() (n int)

func (*Result) String

func (m *Result) String() string

func (*Result) Unmarshal

func (m *Result) Unmarshal(data []byte) error

type Result_Row

type Result_Row struct {
	Values []Datum `protobuf:"bytes,1,rep,name=values" json:"values"`
}

A Row is a collection of values representing a row in a result.

func (*Result_Row) GetValues

func (m *Result_Row) GetValues() []Datum

func (*Result_Row) Marshal

func (m *Result_Row) Marshal() (data []byte, err error)

func (*Result_Row) MarshalTo

func (m *Result_Row) MarshalTo(data []byte) (int, error)

func (*Result_Row) ProtoMessage

func (*Result_Row) ProtoMessage()

func (*Result_Row) Reset

func (m *Result_Row) Reset()

func (*Result_Row) Size

func (m *Result_Row) Size() (n int)

func (*Result_Row) String

func (m *Result_Row) String() string

func (*Result_Row) Unmarshal

func (m *Result_Row) Unmarshal(data []byte) error

type Sender

type Sender interface {
	// Send dispatches a `Request` and returns the resulting `Response` with an
	// optional transmission error.
	Send(Request) (Response, error)
}

Sender is an interface for sending a request to a SQL database backend.

Jump to

Keyboard shortcuts

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