Documentation ¶
Index ¶
- func BindVariablesToProto3(bindVars map[string]interface{}) (map[string]*pb.BindVariable, error)
- func BoundQueryToProto3(sql string, bindVars map[string]interface{}) (*pb.BoundQuery, error)
- func Proto3ToBindVariables(bv map[string]*pb.BindVariable) map[string]interface{}
- func QueryResultListToProto3(results []mproto.QueryResult) []*pb.QueryResult
- func QuerySplitsToProto3(queries []QuerySplit) ([]*pb.QuerySplit, error)
- func TargetToProto3(target *Target) *pb.Target
- type BeginRequest
- type BeginResponse
- type BoundQuery
- type CallerID
- type CommitRequest
- type CommitResponse
- type ExecuteBatchRequest
- type ExecuteRequest
- type GetSessionIdRequest
- type Query
- type QueryList
- type QueryResultList
- type QuerySplit
- type RollbackRequest
- type RollbackResponse
- type Session
- type SessionInfo
- type SessionParams
- type SplitQueryRequest
- type SplitQueryResult
- type StreamExecuteRequest
- type StreamExecuteResponse
- type TabletType
- type Target
- type TransactionInfo
- type VTGateCallerID
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BindVariablesToProto3 ¶
func BindVariablesToProto3(bindVars map[string]interface{}) (map[string]*pb.BindVariable, error)
BindVariablesToProto3 converts internal type to proto3 BindVariable array
func BoundQueryToProto3 ¶
func BoundQueryToProto3(sql string, bindVars map[string]interface{}) (*pb.BoundQuery, error)
BoundQueryToProto3 converts internal types to proto3 BoundQuery
func Proto3ToBindVariables ¶
func Proto3ToBindVariables(bv map[string]*pb.BindVariable) map[string]interface{}
Proto3ToBindVariables converts a proto.BinVariable map to internal data structure
func QueryResultListToProto3 ¶
func QueryResultListToProto3(results []mproto.QueryResult) []*pb.QueryResult
QueryResultListToProto3 changes the internal array of QueryResult to the proto3 version
func QuerySplitsToProto3 ¶
func QuerySplitsToProto3(queries []QuerySplit) ([]*pb.QuerySplit, error)
QuerySplitsToProto3 converts a native QuerySplit array to the proto3 version
func TargetToProto3 ¶
TargetToProto3 transform the bson RPC target to proto3
Types ¶
type BeginRequest ¶
type BeginRequest struct { EffectiveCallerID *CallerID ImmediateCallerID *VTGateCallerID Target *Target // Although SessionId is not part of the proto3 interface, we're adding it here // for backwards compatibility reasons. The proto3 interface defines the future, // where we think there might not be a need for SessionID. SessionId int64 }
BeginRequest is the BSON implementation of the proto3 query.BeginkRequest
type BeginResponse ¶
type BeginResponse struct { // Err is named 'Err' instead of 'Error' (as the proto3 version is) to remain // consistent with other BSON structs. Err *mproto.RPCError TransactionId int64 }
BeginResponse is the BSON implementation of the proto3 query.BeginResponse
type BoundQuery ¶
BoundQuery is one query in a QueryList.
func Proto3ToBoundQuery ¶
func Proto3ToBoundQuery(query *pb.BoundQuery) *BoundQuery
Proto3ToBoundQuery converts a proto.BoundQuery to the internal data structure
func Proto3ToBoundQueryList ¶
func Proto3ToBoundQueryList(queries []*pb.BoundQuery) []BoundQuery
Proto3ToBoundQueryList converts am array of proto.BoundQuery to the internal data structure
func (*BoundQuery) MarshalBson ¶
func (boundQuery *BoundQuery) MarshalBson(buf *bytes2.ChunkedWriter, key string)
MarshalBson bson-encodes BoundQuery.
func (*BoundQuery) UnmarshalBson ¶
func (boundQuery *BoundQuery) UnmarshalBson(buf *bytes.Buffer, kind byte)
UnmarshalBson bson-decodes into BoundQuery.
type CallerID ¶
CallerID is the BSON implementation of the proto3 vtrpc.CallerID
func (*CallerID) MarshalBson ¶
func (callerID *CallerID) MarshalBson(buf *bytes2.ChunkedWriter, key string)
MarshalBson bson-encodes CallerID.
type CommitRequest ¶
type CommitRequest struct { EffectiveCallerID *CallerID ImmediateCallerID *VTGateCallerID Target *Target TransactionId int64 // Although SessionId is not part of the proto3 interface, we're adding it here // for backwards compatibility reasons. The proto3 interface defines the future, // where we think there might not be a need for SessionID. SessionId int64 }
CommitRequest is the BSON implementation of the proto3 query.CommitRequest
type CommitResponse ¶
type CommitResponse struct { // Err is named 'Err' instead of 'Error' (as the proto3 version is) to remain // consistent with other BSON structs. Err *mproto.RPCError }
CommitResponse is the BSON implementation of the proto3 query.CommitResponse
type ExecuteBatchRequest ¶
type ExecuteBatchRequest struct { QueryBatch QueryList EffectiveCallerID *CallerID ImmediateCallerID *VTGateCallerID Target *Target }
ExecuteBatchRequest is the payload to ExecuteBatch2, it contains both QueryList which is the actual payload and the CallerIDs
type ExecuteRequest ¶
type ExecuteRequest struct { QueryRequest Query EffectiveCallerID *CallerID ImmediateCallerID *VTGateCallerID Target *Target }
ExecuteRequest contains Query and CallerIDs. it is the payload to Execute2, which is the CallerID enabled version of Execute
type GetSessionIdRequest ¶
type GetSessionIdRequest struct { Params SessionParams EffectiveCallerID *CallerID ImmediateCallerID *VTGateCallerID }
GetSessionIdRequest is the CallerID enabled version of SessionParams. It contains SessionParams, which is passed to GetSessionId. The server will double-check the keyspace and shard are what the tablet is serving.
type Query ¶
type Query struct { Sql string BindVariables map[string]interface{} SessionId int64 TransactionId int64 }
Query is the payload to Execute.
func (*Query) MarshalBson ¶
func (query *Query) MarshalBson(buf *bytes2.ChunkedWriter, key string)
MarshalBson bson-encodes Query.
type QueryList ¶
type QueryList struct { Queries []BoundQuery SessionId int64 AsTransaction bool TransactionId int64 }
QueryList is the payload to ExecuteBatch.
func (*QueryList) MarshalBson ¶
func (queryList *QueryList) MarshalBson(buf *bytes2.ChunkedWriter, key string)
MarshalBson bson-encodes QueryList.
type QueryResultList ¶
type QueryResultList struct { List []mproto.QueryResult Err *mproto.RPCError }
QueryResultList is the return type for ExecuteBatch.
func Proto3ToQueryResultList ¶
func Proto3ToQueryResultList(results []*pb.QueryResult) *QueryResultList
Proto3ToQueryResultList converts a proto3 QueryResult to an internal data structure.
func (*QueryResultList) MarshalBson ¶
func (queryResultList *QueryResultList) MarshalBson(buf *bytes2.ChunkedWriter, key string)
MarshalBson bson-encodes QueryResultList.
func (*QueryResultList) UnmarshalBson ¶
func (queryResultList *QueryResultList) UnmarshalBson(buf *bytes.Buffer, kind byte)
UnmarshalBson bson-decodes into QueryResultList.
type QuerySplit ¶
type QuerySplit struct { Query BoundQuery RowCount int64 }
QuerySplit represents a split of SplitQueryRequest.Query. RowCount is only approximate.
func Proto3ToQuerySplits ¶
func Proto3ToQuerySplits(queries []*pb.QuerySplit) []QuerySplit
Proto3ToQuerySplits converts a proto3 QuerySplit array to a native QuerySplit array
type RollbackRequest ¶
type RollbackRequest struct { EffectiveCallerID *CallerID ImmediateCallerID *VTGateCallerID Target *Target TransactionId int64 // Although SessionId is not part of the proto3 interface, we're adding it here // for backwards compatibility reasons. The proto3 interface defines the future, // where we think there might not be a need for SessionID. SessionId int64 }
RollbackRequest is the BSON implementation of the proto3 query.RollbackRequest
type RollbackResponse ¶
type RollbackResponse struct { // Err is named 'Err' instead of 'Error' (as the proto3 version is) to remain // consistent with other BSON structs. Err *mproto.RPCError }
RollbackResponse is the BSON implementation of the proto3 query.RollbackResponse
type Session ¶
Session is passed to all calls.
func (*Session) MarshalBson ¶
func (session *Session) MarshalBson(buf *bytes2.ChunkedWriter, key string)
MarshalBson bson-encodes Session.
type SessionInfo ¶
SessionInfo is returned by GetSessionId. Use the provided session_id in the Session object for any subsequent call.
func (*SessionInfo) MarshalBson ¶
func (sessionInfo *SessionInfo) MarshalBson(buf *bytes2.ChunkedWriter, key string)
MarshalBson bson-encodes SessionInfo.
func (*SessionInfo) UnmarshalBson ¶
func (sessionInfo *SessionInfo) UnmarshalBson(buf *bytes.Buffer, kind byte)
UnmarshalBson bson-decodes into SessionInfo.
type SessionParams ¶
SessionParams is passed to GetSessionId. The server will double-check the keyspace and shard are what the tablet is serving.
type SplitQueryRequest ¶
type SplitQueryRequest struct { Query BoundQuery SplitColumn string SplitCount int SessionID int64 EffectiveCallerID *CallerID ImmediateCallerID *VTGateCallerID Target *Target }
SplitQueryRequest represents a request to split a Query into queries that each return a subset of the original query. SplitColumn: preferred column to split. Server will pick a random PK column
if this field is empty or returns an error if this field is not empty but not found in schema info or not be indexed.
type SplitQueryResult ¶
type SplitQueryResult struct { Queries []QuerySplit Err *mproto.RPCError }
SplitQueryResult represents the result of a SplitQueryRequest
type StreamExecuteRequest ¶
type StreamExecuteRequest struct { EffectiveCallerID *CallerID ImmediateCallerID *VTGateCallerID Target *Target // Query here is of type Query instead of BoundQuery because of backwards compatibility. // The proto3 interface defines the future, where we think there might not be a need for SessionID. Query *Query }
StreamExecuteRequest is the BSON implementation of the proto3 query.StreamExecuteRequest
type StreamExecuteResponse ¶
type StreamExecuteResponse struct { Result *mproto.QueryResult // Err is named 'Err' instead of 'Error' (as the proto3 version is) to remain // consistent with other BSON structs. Err *mproto.RPCError }
StreamExecuteResponse is the BSON implementation of the proto3 query.StreamExecuteResponse
type TabletType ¶
type TabletType int64
TabletType is the BSON implementation of the proto3 query.TabletType. Assumes that enums are expressed as int64 in BSON.
type Target ¶
type Target struct { Keyspace string Shard string TabletType TabletType }
Target is the BSON implementation of the proto3 query.Target
type TransactionInfo ¶
TransactionInfo is returned by Begin. Use the provided transaction_id in the Session object for any subsequent call to be inside the transaction.
func (*TransactionInfo) MarshalBson ¶
func (transactionInfo *TransactionInfo) MarshalBson(buf *bytes2.ChunkedWriter, key string)
MarshalBson bson-encodes TransactionInfo.
func (*TransactionInfo) UnmarshalBson ¶
func (transactionInfo *TransactionInfo) UnmarshalBson(buf *bytes.Buffer, kind byte)
UnmarshalBson bson-decodes into TransactionInfo.
type VTGateCallerID ¶
type VTGateCallerID struct {
Username string
}
VTGateCallerID is the BSON implementation of the proto3 query.VTGateCallerID