import "github.com/youtube/vitess/go/vt/vtgate/proto" func executeQuery(query string) (*proto.QueryResult, error) { // send query to vtgate server result, err := vtgate.Execute(query) if err != nil { return nil, err } return result, nil }
import "github.com/youtube/vitess/go/vt/vtgate/proto" func printResult(result *proto.QueryResult) { for _, row := range result.Rows { for i, value := range row { fmt.Printf("%s: %s\n", result.Fields[i].Name, value.Value) } fmt.Println("---") } }In this example, we import the proto package and use the QueryResult struct to represent the result of a query sent to the vtgate server. The printResult function takes the QueryResult struct and prints it in a user-friendly format. In summary, the go github.com.youtube.vitess.go.vt.vtgate.proto package library provides the QueryResult struct, which represents the result of a query sent to a vtgate server. It is used in functions that send queries to the vtgate server and process the resulting data.