driver

package
v0.0.0-...-6538a59 Latest Latest
Warning

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

Go to latest
Published: Aug 4, 2015 License: Apache-2.0 Imports: 15 Imported by: 0

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:

RequestHeader
ResponseHeader
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/"
)

Variables

This section is empty.

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"`
	XXX_unrecognized []byte   `json:"-"`
}

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) 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) (n int, err 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 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 {
	// Request header.
	RequestHeader `protobuf:"bytes,1,opt,name=header,embedded=header" json:"header"`
	// 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,2,opt,name=sql" json:"sql"`
	// Parameters referred to in the above SQL statement(s) using "?".
	Params           []Datum `protobuf:"bytes,3,rep,name=params" json:"params"`
	XXX_unrecognized []byte  `json:"-"`
}

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) GetSql

func (m *Request) GetSql() string

func (*Request) Marshal

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

func (*Request) MarshalTo

func (m *Request) MarshalTo(data []byte) (n int, err 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 RequestHeader

type RequestHeader struct {
	// User is the originating user.
	User string `protobuf:"bytes,5,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,1,opt,name=session" json:"session,omitempty"`
	// The transaction state returned in the previous response being
	// reflected back.
	Txn []byte `protobuf:"bytes,2,opt,name=txn" json:"txn,omitempty"`
	// CmdID is optionally specified for request idempotence
	// (i.e. replay protection).
	CmdID            cockroach_proto3.ClientCmdID `protobuf:"bytes,3,opt,name=cmd_id" json:"cmd_id"`
	XXX_unrecognized []byte                       `json:"-"`
}

RequestHeader is supplied with every Request.

func (*RequestHeader) GetCmdID

func (*RequestHeader) GetSession

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

func (*RequestHeader) GetTxn

func (m *RequestHeader) GetTxn() []byte

func (*RequestHeader) GetUser

func (m *RequestHeader) GetUser() string

func (*RequestHeader) Header

func (r *RequestHeader) Header() *RequestHeader

Header returns the request header.

func (*RequestHeader) Marshal

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

func (*RequestHeader) MarshalTo

func (m *RequestHeader) MarshalTo(data []byte) (n int, err error)

func (*RequestHeader) ProtoMessage

func (*RequestHeader) ProtoMessage()

func (*RequestHeader) Reset

func (m *RequestHeader) Reset()

func (*RequestHeader) Size

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

func (*RequestHeader) String

func (m *RequestHeader) String() string

func (*RequestHeader) Unmarshal

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

type Response

type Response struct {
	ResponseHeader `protobuf:"bytes,1,opt,name=header,embedded=header" json:"header"`
	// 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"`
	XXX_unrecognized []byte   `json:"-"`
}

func (*Response) GetResults

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

func (*Response) Marshal

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

func (*Response) MarshalTo

func (m *Response) MarshalTo(data []byte) (n int, err 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 ResponseHeader

type ResponseHeader struct {
	// Error is non-nil if an error occurred.
	Error *cockroach_proto2.Error `protobuf:"bytes,1,opt,name=error" json:"error,omitempty"`
	// 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,2,opt,name=session" json:"session,omitempty"`
	// Transaction message returned in a response; not to be interpreted by
	// the recipient and reflected in a subsequent request. When not set,
	// the subsequent request should not contain a transaction object.
	Txn              []byte `protobuf:"bytes,3,opt,name=txn" json:"txn,omitempty"`
	XXX_unrecognized []byte `json:"-"`
}

ResponseHeader is returned with every Response.

func (*ResponseHeader) GetError

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

func (*ResponseHeader) GetSession

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

func (*ResponseHeader) GetTxn

func (m *ResponseHeader) GetTxn() []byte

func (*ResponseHeader) Header

func (r *ResponseHeader) Header() *ResponseHeader

Header returns the response header.

func (*ResponseHeader) Marshal

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

func (*ResponseHeader) MarshalTo

func (m *ResponseHeader) MarshalTo(data []byte) (n int, err error)

func (*ResponseHeader) ProtoMessage

func (*ResponseHeader) ProtoMessage()

func (*ResponseHeader) Reset

func (m *ResponseHeader) Reset()

func (*ResponseHeader) Size

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

func (*ResponseHeader) String

func (m *ResponseHeader) String() string

func (*ResponseHeader) Unmarshal

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

type Result

type Result struct {
	// 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,1,rep,name=columns" json:"columns,omitempty"`
	// The rows in the result set.
	Rows             []Result_Row `protobuf:"bytes,2,rep,name=rows" json:"rows"`
	XXX_unrecognized []byte       `json:"-"`
}

A Result is a collection of rows.

func (*Result) GetColumns

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

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) (n int, err 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"`
	XXX_unrecognized []byte  `json:"-"`
}

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) (n int, err 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