driver

package
v0.0.0-...-ac77e4e Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2015 License: Apache-2.0 Imports: 23 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:

Datum
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 RPCMethod = "Server.SQL"

RPCMethod is the name of the RPC method for SQL requests.

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")
	ErrIntOverflowWire   = fmt.Errorf("proto: integer overflow")
)

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 Date

type Date int64

Date is the number of days since the Unix epoch. It provides a custom String() method.

func MakeDate

func MakeDate(t time.Time) Date

MakeDate constructs a Date from a time.Time.

func (Date) String

func (d Date) String() string

String returns the underlying time formatted using the format string "2006-01-02".

type Datum

type Datum struct {
	// Using explicit proto types provides convenient access when using json. If
	// we used a Kind+Bytes approach the json interface would involve base64
	// encoded data.
	//
	// Types that are valid to be assigned to Payload:
	//	*Datum_BoolVal
	//	*Datum_IntVal
	//	*Datum_FloatVal
	//	*Datum_BytesVal
	//	*Datum_StringVal
	//	*Datum_DateVal
	//	*Datum_TimeVal
	//	*Datum_IntervalVal
	Payload isDatum_Payload `protobuf_oneof:"payload"`
}

func (*Datum) GetBoolVal

func (m *Datum) GetBoolVal() bool

func (*Datum) GetBytesVal

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

func (*Datum) GetDateVal

func (m *Datum) GetDateVal() int64

func (*Datum) GetFloatVal

func (m *Datum) GetFloatVal() float64

func (*Datum) GetIntVal

func (m *Datum) GetIntVal() int64

func (*Datum) GetIntervalVal

func (m *Datum) GetIntervalVal() int64

func (*Datum) GetPayload

func (m *Datum) GetPayload() isDatum_Payload

func (*Datum) GetStringVal

func (m *Datum) GetStringVal() string

func (*Datum) GetTimeVal

func (m *Datum) GetTimeVal() *Datum_Timestamp

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

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

func (*Datum) String

func (m *Datum) String() string

func (*Datum) Unmarshal

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

func (Datum) Value

func (d Datum) Value() (driver.Value, error)

Value implements the driver.Valuer interface.

func (*Datum) XXX_OneofFuncs

func (*Datum) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), []interface{})

XXX_OneofFuncs is for the internal use of the proto package.

type Datum_BoolVal

type Datum_BoolVal struct {
	BoolVal bool `protobuf:"varint,1,opt,name=bool_val,oneof"`
}

func (*Datum_BoolVal) MarshalTo

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

func (*Datum_BoolVal) Size

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

type Datum_BytesVal

type Datum_BytesVal struct {
	BytesVal []byte `protobuf:"bytes,4,opt,name=bytes_val,oneof"`
}

func (*Datum_BytesVal) MarshalTo

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

func (*Datum_BytesVal) Size

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

type Datum_DateVal

type Datum_DateVal struct {
	DateVal int64 `protobuf:"varint,6,opt,name=date_val,oneof"`
}

func (*Datum_DateVal) MarshalTo

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

func (*Datum_DateVal) Size

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

type Datum_FloatVal

type Datum_FloatVal struct {
	FloatVal float64 `protobuf:"fixed64,3,opt,name=float_val,oneof"`
}

func (*Datum_FloatVal) MarshalTo

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

func (*Datum_FloatVal) Size

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

type Datum_IntVal

type Datum_IntVal struct {
	IntVal int64 `protobuf:"varint,2,opt,name=int_val,oneof"`
}

func (*Datum_IntVal) MarshalTo

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

func (*Datum_IntVal) Size

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

type Datum_IntervalVal

type Datum_IntervalVal struct {
	IntervalVal int64 `protobuf:"varint,8,opt,name=interval_val,oneof"`
}

func (*Datum_IntervalVal) MarshalTo

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

func (*Datum_IntervalVal) Size

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

type Datum_StringVal

type Datum_StringVal struct {
	StringVal string `protobuf:"bytes,5,opt,name=string_val,oneof"`
}

func (*Datum_StringVal) MarshalTo

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

func (*Datum_StringVal) Size

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

type Datum_TimeVal

type Datum_TimeVal struct {
	TimeVal *Datum_Timestamp `protobuf:"bytes,7,opt,name=time_val,oneof"`
}

func (*Datum_TimeVal) MarshalTo

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

func (*Datum_TimeVal) Size

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

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 Timestamp

func Timestamp(t time.Time) Datum_Timestamp

Timestamp converts a time.Time to a timestamp.

func (Datum_Timestamp) GoTime

func (t Datum_Timestamp) GoTime() time.Time

GoTime returns the receiver as a time.Time.

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

func (r Request) GetUser() string

GetUser implements security.RequestWithUser.

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 []Response_Result `protobuf:"bytes,2,rep,name=results" json:"results"`
}

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 Response_Result

type Response_Result struct {
	// Error is non-nil if an error occurred while executing the statement.
	Error *string `protobuf:"bytes,1,opt,name=error" json:"error,omitempty"`
	// Types that are valid to be assigned to Union:
	//	*Response_Result_DDL_
	//	*Response_Result_RowsAffected
	//	*Response_Result_Rows_
	Union isResponse_Result_Union `protobuf_oneof:"union"`
}

Result corresponds to the execution of a single SQL statement.

func (*Response_Result) GetDDL

func (m *Response_Result) GetDDL() *Response_Result_DDL

func (*Response_Result) GetRows

func (m *Response_Result) GetRows() *Response_Result_Rows

func (*Response_Result) GetRowsAffected

func (m *Response_Result) GetRowsAffected() uint32

func (*Response_Result) GetUnion

func (m *Response_Result) GetUnion() isResponse_Result_Union

func (*Response_Result) Marshal

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

func (*Response_Result) MarshalTo

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

func (*Response_Result) ProtoMessage

func (*Response_Result) ProtoMessage()

func (*Response_Result) Reset

func (m *Response_Result) Reset()

func (*Response_Result) Size

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

func (*Response_Result) String

func (m *Response_Result) String() string

func (*Response_Result) Unmarshal

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

func (*Response_Result) XXX_OneofFuncs

func (*Response_Result) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), []interface{})

XXX_OneofFuncs is for the internal use of the proto package.

type Response_Result_DDL

type Response_Result_DDL struct {
}

DDL is an empty message that is used in Result's oneof. Its presence indicates that the operation was a DDL statement.

func (*Response_Result_DDL) Marshal

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

func (*Response_Result_DDL) MarshalTo

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

func (*Response_Result_DDL) ProtoMessage

func (*Response_Result_DDL) ProtoMessage()

func (*Response_Result_DDL) Reset

func (m *Response_Result_DDL) Reset()

func (*Response_Result_DDL) Size

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

func (*Response_Result_DDL) String

func (m *Response_Result_DDL) String() string

func (*Response_Result_DDL) Unmarshal

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

type Response_Result_DDL_

type Response_Result_DDL_ struct {
	DDL *Response_Result_DDL `protobuf:"bytes,2,opt,name=ddl,oneof"`
}

func (*Response_Result_DDL_) MarshalTo

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

func (*Response_Result_DDL_) Size

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

type Response_Result_Rows

type Response_Result_Rows struct {
	// The names and types 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 []*Response_Result_Rows_Column `protobuf:"bytes,1,rep,name=columns" json:"columns,omitempty"`
	// The rows in the result set.
	Rows []Response_Result_Rows_Row `protobuf:"bytes,2,rep,name=rows" json:"rows"`
}

Rows encapsulates the result of an operation that returns rows.

func (*Response_Result_Rows) Marshal

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

func (*Response_Result_Rows) MarshalTo

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

func (*Response_Result_Rows) ProtoMessage

func (*Response_Result_Rows) ProtoMessage()

func (*Response_Result_Rows) Reset

func (m *Response_Result_Rows) Reset()

func (*Response_Result_Rows) Size

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

func (*Response_Result_Rows) String

func (m *Response_Result_Rows) String() string

func (*Response_Result_Rows) Unmarshal

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

type Response_Result_RowsAffected

type Response_Result_RowsAffected struct {
	RowsAffected uint32 `protobuf:"varint,3,opt,name=rows_affected,oneof"`
}

func (*Response_Result_RowsAffected) MarshalTo

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

func (*Response_Result_RowsAffected) Size

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

type Response_Result_Rows_

type Response_Result_Rows_ struct {
	Rows *Response_Result_Rows `protobuf:"bytes,4,opt,name=rows,oneof"`
}

func (*Response_Result_Rows_) MarshalTo

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

func (*Response_Result_Rows_) Size

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

type Response_Result_Rows_Column

type Response_Result_Rows_Column struct {
	Name string `protobuf:"bytes,1,opt,name=name" json:"name"`
	Typ  Datum  `protobuf:"bytes,2,opt,name=typ" json:"typ"`
}

A Column contains the name and type of a SQL "cell".

func (*Response_Result_Rows_Column) Marshal

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

func (*Response_Result_Rows_Column) MarshalTo

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

func (*Response_Result_Rows_Column) ProtoMessage

func (*Response_Result_Rows_Column) ProtoMessage()

func (*Response_Result_Rows_Column) Reset

func (m *Response_Result_Rows_Column) Reset()

func (*Response_Result_Rows_Column) Size

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

func (*Response_Result_Rows_Column) String

func (m *Response_Result_Rows_Column) String() string

func (*Response_Result_Rows_Column) Unmarshal

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

type Response_Result_Rows_Row

type Response_Result_Rows_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 (*Response_Result_Rows_Row) Marshal

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

func (*Response_Result_Rows_Row) MarshalTo

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

func (*Response_Result_Rows_Row) ProtoMessage

func (*Response_Result_Rows_Row) ProtoMessage()

func (*Response_Result_Rows_Row) Reset

func (m *Response_Result_Rows_Row) Reset()

func (*Response_Result_Rows_Row) Size

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

func (*Response_Result_Rows_Row) String

func (m *Response_Result_Rows_Row) String() string

func (*Response_Result_Rows_Row) Unmarshal

func (m *Response_Result_Rows_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