import "github.com.youtube.vitess.go.vt.vtgate.proto" qrList := &proto.QueryResultList{ Results: []*proto.QueryResult{ { RowsAffected: 3, Rows: []*proto.Row{ { Values: []*proto.Value{ { Type: proto.QueryResultType_INT, Value: []byte("1"), }, { Type: proto.QueryResultType_STRING, Value: []byte("John"), }, }, }, { Values: []*proto.Value{ { Type: proto.QueryResultType_INT, Value: []byte("2"), }, { Type: proto.QueryResultType_STRING, Value: []byte("Jane"), }, }, }, }, }, }, }
import "github.com/golang/protobuf/proto" qrList := &proto.QueryResultList{...} data, err := proto.Marshal(qrList) if err != nil { panic(err) }
import "github.com/golang/protobuf/proto" data := []byte{...} qrList := &proto.QueryResultList{} err := proto.Unmarshal(data, qrList) if err != nil { panic(err) }