Documentation

Overview

    Package querytypes defines internal types used in the APIs to deal with queries.

    Index

    Constants

    This section is empty.

    Variables

    This section is empty.

    Functions

    func BindVariablesToProto3

    func BindVariablesToProto3(bindVars map[string]interface{}) (map[string]*querypb.BindVariable, error)

      BindVariablesToProto3 converts internal type to proto3 BindVariable array

      func BoundQueriesToProto3

      func BoundQueriesToProto3(sql []string, bindVars []map[string]interface{}) ([]*querypb.BoundQuery, error)

        BoundQueriesToProto3 converts internal types to proto3 BoundQuery

        func BoundQueryToProto3

        func BoundQueryToProto3(sql string, bindVars map[string]interface{}) (*querypb.BoundQuery, error)

          BoundQueryToProto3 converts internal types to proto3 BoundQuery

          func Proto3ToBindVariables

          func Proto3ToBindVariables(bv map[string]*querypb.BindVariable) (map[string]interface{}, error)

            Proto3ToBindVariables converts a proto.BinVariable map to internal data structure

            func QueryAsString

            func QueryAsString(sql string, bindVariables map[string]interface{}) string

              QueryAsString prints a readable version of query+bind variables, and also truncates data if it's too long

              func QueryResultListToProto3

              func QueryResultListToProto3(results []sqltypes.Result) []*querypb.QueryResult

                QueryResultListToProto3 temporarily resurrected.

                func QuerySplitsToProto3

                func QuerySplitsToProto3(queries []QuerySplit) ([]*querypb.QuerySplit, error)

                  QuerySplitsToProto3 converts a native QuerySplit array to the proto3 version

                  Types

                  type BoundQuery

                  type BoundQuery struct {
                  	// Sql is the query
                  	Sql string
                  
                  	// BindVariables is the map of bind variables for the query
                  	BindVariables map[string]interface{}
                  }

                    BoundQuery is one query in a QueryList. We only use it in arrays. For a single query, we just use Sql and BindVariables directly.

                    func Proto3ToBoundQuery

                    func Proto3ToBoundQuery(query *querypb.BoundQuery) (*BoundQuery, error)

                      Proto3ToBoundQuery converts a proto.BoundQuery to the internal data structure

                      func Proto3ToBoundQueryList

                      func Proto3ToBoundQueryList(queries []*querypb.BoundQuery) ([]BoundQuery, error)

                        Proto3ToBoundQueryList converts am array of proto.BoundQuery to the internal data structure

                        type QuerySplit

                        type QuerySplit struct {
                        	// Sql is the query
                        	Sql string
                        
                        	// BindVariables is the map of bind variables for the query
                        	BindVariables map[string]interface{}
                        
                        	// RowCount is the approximate number of rows this query will return
                        	RowCount int64
                        }

                          QuerySplit represents a split of a query, used for MapReduce purposes.

                          func Proto3ToQuerySplits

                          func Proto3ToQuerySplits(queries []*querypb.QuerySplit) ([]QuerySplit, error)

                            Proto3ToQuerySplits converts a proto3 QuerySplit array to a native QuerySplit array