Database governance built for humans and agents — controlling changes and access across every major database.
Go cicddata-governancedata-maskingdata-securitydatabase-accessdatabase-governancedevopsdevsecopsflywaygitopsliquibasemongodbmysqloraclepostgresqlschema-migrationssecuritysql-clientsqlservertidb
chore: implement Query2 for v1 sql query API (#6342)
rebelice6f6de6c7cac4
diff --git a/backend/plugin/advisor/utils_for_tests.go b/backend/plugin/advisor/utils_for_tests.goindex 24e3118b66..878bb095b3 100644--- a/backend/plugin/advisor/utils_for_tests.go+++ b/backend/plugin/advisor/utils_for_tests.go@@ -20,6 +20,7 @@ import ("github.com/bytebase/bytebase/backend/plugin/advisor/db"database "github.com/bytebase/bytebase/backend/plugin/db"storepb "github.com/bytebase/bytebase/proto/generated-go/store"+ v1pb "github.com/bytebase/bytebase/proto/generated-go/v1")var (@@ -248,6 +249,11 @@ func (*MockDriver) Execute(_ context.Context, _ string, _ bool) (int64, error) {return 0, nil}+// QueryConn2 queries a SQL statement in a given connection.+func (*MockDriver) QueryConn2(_ context.Context, _ *sql.Conn, _ string, _ *database.QueryContext) ([]*v1pb.QueryResult, error) {+ return nil, nil+}+// QueryConn implements the Driver interface.func (*MockDriver) QueryConn(_ context.Context, _ *sql.Conn, statement string, _ *database.QueryContext) ([]any, error) {switch statement {diff --git a/backend/plugin/db/clickhouse/clickhouse.go b/backend/plugin/db/clickhouse/clickhouse.goindex 3776edec1a..6c93a89d0f 100644--- a/backend/plugin/db/clickhouse/clickhouse.go+++ b/backend/plugin/db/clickhouse/clickhouse.go@@ -16,6 +16,7 @@ import ("github.com/bytebase/bytebase/backend/common/log""github.com/bytebase/bytebase/backend/plugin/db""github.com/bytebase/bytebase/backend/plugin/db/util"+ v1pb "github.com/bytebase/bytebase/proto/generated-go/v1")var (@@ -157,3 +158,8 @@ func (driver *Driver) Execute(ctx context.Context, statement string, _ bool) (infunc (driver *Driver) QueryConn(ctx context.Context, conn *sql.Conn, statement string, queryContext *db.QueryContext) ([]any, error) {return util.Query(ctx, driver.dbType, conn, statement, queryContext)}++// QueryConn2 queries a SQL statement in a given connection.+func (*Driver) QueryConn2(_ context.Context, _ *sql.Conn, _ string, _ *db.QueryContext) ([]*v1pb.QueryResult, error) {+ return nil, errors.New("not implemented")+}diff --git a/backend/plugin/db/driver.go b/backend/plugin/db/driver.goindex 437e61908c..815132e6aa 100644--- a/backend/plugin/db/driver.go+++ b/backend/plugin/db/driver.go@@ -16,6 +16,7 @@ import ("github.com/bytebase/bytebase/backend/plugin/vcs"storepb "github.com/bytebase/bytebase/proto/generated-go/store"+ v1pb "github.com/bytebase/bytebase/proto/generated-go/v1")// Type is the type of a database.@@ -492,6 +493,9 @@ type Driver interface {Execute(ctx context.Context, statement string, createDatabase bool) (int64, error)// Used for execute readonly SELECT statementQueryConn(ctx context.Context, conn *sql.Conn, statement string, queryContext *QueryContext) ([]any, error)+ // Used for execute readonly SELECT statement+ // TODO(rebelice): remove QueryConn and rename QueryConn2 to QueryConn when legacy code is removed.+ QueryConn2(ctx context.Context, conn *sql.Conn, statement string, queryContext *QueryContext) ([]*v1pb.QueryResult, error)// Sync schema// SyncInstance syncs the instance metadata.diff --git a/backend/plugin/db/mongodb/mongodb.go b/backend/plugin/db/mongodb/mongodb.goindex 6c36a66337..e837ed238b 100644--- a/backend/plugin/db/mongodb/mongodb.go+++ b/backend/plugin/db/mongodb/mongodb.go@@ -18,6 +18,7 @@ import ("github.com/bytebase/bytebase/backend/plugin/db""github.com/bytebase/bytebase/backend/resources/mongoutil"+ v1pb "github.com/bytebase/bytebase/proto/generated-go/v1")var (@@ -211,3 +212,8 @@ func replaceCharacterWithPercentEncoding(s string) string {}return s}++// QueryConn2 queries a SQL statement in a given connection.+func (*Driver) QueryConn2(_ context.Context, _ *sql.Conn, _ string, _ *db.QueryContext) ([]*v1pb.QueryResult, error) {+ return nil, errors.New("not implemented")+}diff --git a/backend/plugin/db/mssql/mssql.go b/backend/plugin/db/mssql/mssql.goindex 7e47d3db4b..e18b8995c4 100644--- a/backend/plugin/db/mssql/mssql.go+++ b/backend/plugin/db/mssql/mssql.go@@ -11,6 +11,7 @@ import (// Import go-ora Oracle driver._ "github.com/microsoft/go-mssqldb"_ "github.com/microsoft/go-mssqldb/integratedauth/krb5"+ "github.com/pkg/errors""go.uber.org/zap"@@ -18,6 +19,7 @@ import ("github.com/bytebase/bytebase/backend/plugin/db""github.com/bytebase/bytebase/backend/plugin/db/util"parser "github.com/bytebase/bytebase/backend/plugin/parser/sql"+ v1pb "github.com/bytebase/bytebase/proto/generated-go/v1")var (@@ -124,3 +126,8 @@ func (driver *Driver) Execute(ctx context.Context, statement string, createDatabfunc (*Driver) QueryConn(ctx context.Context, conn *sql.Conn, statement string, queryContext *db.QueryContext) ([]any, error) {return util.Query(ctx, db.MSSQL, conn, statement, queryContext)}++// QueryConn2 queries a SQL statement in a given connection.+func (*Driver) QueryConn2(_ context.Context, _ *sql.Conn, _ string, _ *db.QueryContext) ([]*v1pb.QueryResult, error) {+ return nil, errors.New("not implemented")+}diff --git a/backend/plugin/db/mysql/mysql.go b/backend/plugin/db/mysql/mysql.goindex c3af1b74fb..1e5ad4757f 100644--- a/backend/plugin/db/mysql/mysql.go+++ b/backend/plugin/db/mysql/mysql.go@@ -20,6 +20,7 @@ import ("github.com/bytebase/bytebase/backend/plugin/db""github.com/bytebase/bytebase/backend/plugin/db/util"bbparser "github.com/bytebase/bytebase/backend/plugin/parser/sql"+ v1pb "github.com/bytebase/bytebase/proto/generated-go/v1")var (@@ -281,3 +282,63 @@ func splitAndTransformDelimiter(statement string) ([]string, error) {}return trunks, nil}++// QueryConn2 queries a SQL statement in a given connection.+func (driver *Driver) QueryConn2(ctx context.Context, conn *sql.Conn, statement string, queryContext *db.QueryContext) ([]*v1pb.QueryResult, error) {+ singleSQLs, err := bbparser.SplitMultiSQL(bbparser.MySQL, statement)+ if err != nil {+ return nil, err+ }+ if len(singleSQLs) == 0 {+ return nil, nil+ }++ var results []*v1pb.QueryResult+ for _, singleSQL := range singleSQLs {+ result, err := driver.querySingleSQL(ctx, conn, singleSQL, queryContext)+ if err != nil {+ results = append(results, &v1pb.QueryResult{+ Error: err.Error(),+ })+ } else {+ results = append(results, result)+ }+ }++ return results, nil+}++func (driver *Driver) getStatementWithResultLimit(stmt string, limit int) (string, error) {+ switch driver.dbType {+ case db.MySQL, db.MariaDB:+ // MySQL 5.7 doesn't support WITH clause.+ return fmt.Sprintf("SELECT * FROM (%s) result LIMIT %d;", stmt, limit), nil+ case db.TiDB:+ return fmt.Sprintf("WITH result AS (%s) SELECT * FROM result LIMIT %d;", stmt, limit), nil+ default:+ return "", errors.Errorf("unsupported database type %s", driver.dbType)+ }+}++func (driver *Driver) querySingleSQL(ctx context.Context, conn *sql.Conn, singleSQL bbparser.SingleSQL, queryContext *db.QueryContext) (*v1pb.QueryResult, error) {+ if singleSQL.Empty {+ return nil, nil+ }+ statement := singleSQL.Text++ if !strings.HasPrefix(statement, "EXPLAIN") && queryContext.Limit > 0 {+ var err error+ statement, err = driver.getStatementWithResultLimit(statement, queryContext.Limit)+ if err != nil {+ return nil, err+ }+ }++ if driver.dbType == db.TiDB && queryContext.ReadOnly {+ // TiDB doesn't support READ ONLY transactions. We have to skip the flag for it.+ // https://github.com/pingcap/tidb/issues/34626+ queryContext.ReadOnly = false+ }++ return util.Query2(ctx, driver.dbType, conn, statement, queryContext)+}diff --git a/backend/plugin/db/oracle/oracle.go b/backend/plugin/db/oracle/oracle.goindex f249a6590c..71e4ab9d4f 100644--- a/backend/plugin/db/oracle/oracle.go+++ b/backend/plugin/db/oracle/oracle.go@@ -16,6 +16,7 @@ import ("github.com/bytebase/bytebase/backend/plugin/db""github.com/bytebase/bytebase/backend/plugin/db/util"parser "github.com/bytebase/bytebase/backend/plugin/parser/sql"+ v1pb "github.com/bytebase/bytebase/proto/generated-go/v1")var (@@ -136,3 +137,8 @@ func (driver *Driver) executeWithBeforeCommitTxFunc(ctx context.Context, statemefunc (*Driver) QueryConn(ctx context.Context, conn *sql.Conn, statement string, queryContext *db.QueryContext) ([]any, error) {return util.Query(ctx, db.Oracle, conn, statement, queryContext)}++// QueryConn2 queries a SQL statement in a given connection.+func (*Driver) QueryConn2(_ context.Context, _ *sql.Conn, _ string, _ *db.QueryContext) ([]*v1pb.QueryResult, error) {+ return nil, errors.New("not implemented")+}diff --git a/backend/plugin/db/pg/pg.go b/backend/plugin/db/pg/pg.goindex ed22de233d..fee4ea70c9 100644--- a/backend/plugin/db/pg/pg.go+++ b/backend/plugin/db/pg/pg.go@@ -25,6 +25,7 @@ import ("github.com/bytebase/bytebase/backend/plugin/db/util"parser "github.com/bytebase/bytebase/backend/plugin/parser/sql"storepb "github.com/bytebase/bytebase/proto/generated-go/store"+ v1pb "github.com/bytebase/bytebase/proto/generated-go/v1")var (@@ -446,3 +447,8 @@ func (*Driver) QueryConn(ctx context.Context, conn *sql.Conn, statement string,}return util.Query(ctx, db.Postgres, conn, statement, queryContext)}++// QueryConn2 queries a SQL statement in a given connection.+func (*Driver) QueryConn2(_ context.Context, _ *sql.Conn, _ string, _ *db.QueryContext) ([]*v1pb.QueryResult, error) {+ return nil, errors.New("not implemented")+}diff --git a/backend/plugin/db/redis/redis.go b/backend/plugin/db/redis/redis.goindex 57821fa39c..4ea4bb8a4c 100644--- a/backend/plugin/db/redis/redis.go+++ b/backend/plugin/db/redis/redis.go@@ -20,6 +20,7 @@ import ("github.com/bytebase/bytebase/backend/common/log""github.com/bytebase/bytebase/backend/plugin/db""github.com/bytebase/bytebase/backend/plugin/db/util"+ v1pb "github.com/bytebase/bytebase/proto/generated-go/v1")var (@@ -228,3 +229,8 @@ func (*Driver) Dump(_ context.Context, _ io.Writer, schemaOnly bool) (string, erfunc (*Driver) Restore(context.Context, io.Reader) error {return errors.New("redis: not supported")}++// QueryConn2 queries a SQL statement in a given connection.+func (*Driver) QueryConn2(_ context.Context, _ *sql.Conn, _ string, _ *db.QueryContext) ([]*v1pb.QueryResult, error) {+ return nil, errors.New("not implemented")+}diff --git a/backend/plugin/db/redshift/redshift.go b/backend/plugin/db/redshift/redshift.goindex 9f055fd549..0a36c52af2 100644--- a/backend/plugin/db/redshift/redshift.go+++ b/backend/plugin/db/redshift/redshift.go@@ -21,6 +21,7 @@ import ("github.com/bytebase/bytebase/backend/plugin/db""github.com/bytebase/bytebase/backend/plugin/db/util"parser "github.com/bytebase/bytebase/backend/plugin/parser/sql"+ v1pb "github.com/bytebase/bytebase/proto/generated-go/v1")var (@@ -395,3 +396,8 @@ func (driver *Driver) GetCurrentDatabaseOwner() (string, error) {}return owner, nil}++// QueryConn2 queries a SQL statement in a given connection.+func (*Driver) QueryConn2(_ context.Context, _ *sql.Conn, _ string, _ *db.QueryContext) ([]*v1pb.QueryResult, error) {+ return nil, errors.New("not implemented")+}diff --git a/backend/plugin/db/snowflake/snowflake.go b/backend/plugin/db/snowflake/snowflake.goindex 4e6f8746f6..aaf9aeca3e 100644--- a/backend/plugin/db/snowflake/snowflake.go+++ b/backend/plugin/db/snowflake/snowflake.go@@ -13,6 +13,7 @@ import ("github.com/bytebase/bytebase/backend/common/log""github.com/bytebase/bytebase/backend/plugin/db""github.com/bytebase/bytebase/backend/plugin/db/util"+ v1pb "github.com/bytebase/bytebase/proto/generated-go/v1"snow "github.com/snowflakedb/gosnowflake""go.uber.org/zap"@@ -255,3 +256,8 @@ func (driver *Driver) Execute(ctx context.Context, statement string, _ bool) (infunc (*Driver) QueryConn(ctx context.Context, conn *sql.Conn, statement string, queryContext *db.QueryContext) ([]any, error) {return util.Query(ctx, db.Snowflake, conn, statement, queryContext)}++// QueryConn2 queries a SQL statement in a given connection.+func (*Driver) QueryConn2(_ context.Context, _ *sql.Conn, _ string, _ *db.QueryContext) ([]*v1pb.QueryResult, error) {+ return nil, errors.New("not implemented")+}diff --git a/backend/plugin/db/spanner/spanner.go b/backend/plugin/db/spanner/spanner.goindex 1d6e8eaa02..d0c970458e 100644--- a/backend/plugin/db/spanner/spanner.go+++ b/backend/plugin/db/spanner/spanner.go@@ -16,6 +16,7 @@ import ("github.com/pkg/errors""github.com/bytebase/bytebase/backend/plugin/db"+ v1pb "github.com/bytebase/bytebase/proto/generated-go/v1""google.golang.org/api/iterator""google.golang.org/api/option"@@ -494,3 +495,8 @@ func getDatabaseFromDSN(dsn string) (string, error) {}return matches["DATABASEGROUP"], nil}++// QueryConn2 queries a SQL statement in a given connection.+func (*Driver) QueryConn2(_ context.Context, _ *sql.Conn, _ string, _ *db.QueryContext) ([]*v1pb.QueryResult, error) {+ return nil, errors.New("not implemented")+}diff --git a/backend/plugin/db/sqlite/sqlite.go b/backend/plugin/db/sqlite/sqlite.goindex b9c531d3b1..27bebfa45e 100644--- a/backend/plugin/db/sqlite/sqlite.go+++ b/backend/plugin/db/sqlite/sqlite.go@@ -17,6 +17,7 @@ import ("github.com/bytebase/bytebase/backend/common/log""github.com/bytebase/bytebase/backend/plugin/db""github.com/bytebase/bytebase/backend/plugin/db/util"+ v1pb "github.com/bytebase/bytebase/proto/generated-go/v1")var (@@ -155,3 +156,8 @@ func (driver *Driver) Execute(ctx context.Context, statement string, createDatabfunc (*Driver) QueryConn(ctx context.Context, conn *sql.Conn, statement string, queryContext *db.QueryContext) ([]any, error) {return util.Query(ctx, db.SQLite, conn, statement, queryContext)}++// QueryConn2 queries a SQL statement in a given connection.+func (*Driver) QueryConn2(_ context.Context, _ *sql.Conn, _ string, _ *db.QueryContext) ([]*v1pb.QueryResult, error) {+ return nil, errors.New("not implemented")+}diff --git a/backend/plugin/db/util/driverutil.go b/backend/plugin/db/util/driverutil.goindex 7018cde902..37d37f98da 100644--- a/backend/plugin/db/util/driverutil.go+++ b/backend/plugin/db/util/driverutil.go@@ -20,9 +20,11 @@ import ("github.com/paulmach/orb/encoding/wkt""github.com/pkg/errors""github.com/shopspring/decimal"+ "google.golang.org/protobuf/types/known/structpb""github.com/bytebase/bytebase/backend/common""github.com/bytebase/bytebase/backend/plugin/db"+ v1pb "github.com/bytebase/bytebase/proto/generated-go/v1")// FormatErrorWithQuery will format the error with failed query.@@ -209,6 +211,73 @@ func Query(ctx context.Context, dbType db.Type, conn *sql.Conn, statement stringreturn []any{columnNames, columnTypeNames, data, fieldMaskInfo}, nil}+// Query2 will execute a readonly / SELECT query.+// TODO(rebelice): remove Query function and rename Query2 to Query after frontend is ready to use the new API.+func Query2(ctx context.Context, dbType db.Type, conn *sql.Conn, statement string, queryContext *db.QueryContext) (*v1pb.QueryResult, error) {+ tx, err := conn.BeginTx(ctx, &sql.TxOptions{ReadOnly: queryContext.ReadOnly})+ if err != nil {+ return nil, err+ }+ defer tx.Rollback()++ rows, err := tx.QueryContext(ctx, statement)+ if err != nil {+ return nil, FormatErrorWithQuery(err, statement)+ }+ defer rows.Close()++ columnNames, err := rows.Columns()+ if err != nil {+ return nil, err+ }++ fieldList, err := extractSensitiveField(dbType, statement, queryContext.CurrentDatabase, queryContext.SensitiveSchemaInfo)+ if err != nil {+ return nil, errors.Wrapf(err, "failed to extract sensitive fields: %q", statement)+ }++ if len(fieldList) != 0 && len(fieldList) != len(columnNames) {+ return nil, errors.Errorf("failed to extract sensitive fields: %q", statement)+ }++ var fieldMaskInfo []bool+ for i := range columnNames {+ if len(fieldList) > 0 && fieldList[i].Sensitive {+ fieldMaskInfo = append(fieldMaskInfo, true)+ } else {+ fieldMaskInfo = append(fieldMaskInfo, false)+ }+ }++ columnTypes, err := rows.ColumnTypes()+ if err != nil {+ return nil, err+ }++ var columnTypeNames []string+ for _, v := range columnTypes {+ // DatabaseTypeName returns the database system name of the column type.+ // refer: https://pkg.go.dev/database/sql#ColumnType.DatabaseTypeName+ columnTypeNames = append(columnTypeNames, strings.ToUpper(v.DatabaseTypeName()))+ }++ data, err := readRows2(rows, dbType, columnTypes, columnTypeNames, fieldList)+ if err != nil {+ return nil, err+ }++ if err := rows.Err(); err != nil {+ return nil, err+ }++ return &v1pb.QueryResult{+ ColumnNames: columnNames,+ ColumnTypeNames: columnTypeNames,+ Rows: data,+ Masked: fieldMaskInfo,+ }, nil+}+// query will execute a query.func queryAdmin(ctx context.Context, dbType db.Type, conn *sql.Conn, statement string, _ int) ([]any, error) {rows, err := conn.QueryContext(ctx, statement)@@ -253,6 +322,71 @@ func queryAdmin(ctx context.Context, dbType db.Type, conn *sql.Conn, statement sreturn []any{columnNames, columnTypeNames, data, sensitiveInfo}, nil}+// TODO(rebelice): remove the readRows and rename readRows2 to readRows if legacy API is deprecated.+func readRows2(rows *sql.Rows, dbType db.Type, columnTypes []*sql.ColumnType, columnTypeNames []string, fieldList []db.SensitiveField) ([]*v1pb.QueryRow, error) {+ if dbType == db.ClickHouse {+ // TODO(rebelice): implement clickhouse support+ return nil, errors.New("clickhouse is not supported")+ }+ var data []*v1pb.QueryRow+ for rows.Next() {+ scanArgs := make([]any, len(columnTypes))+ for i, v := range columnTypeNames {+ // TODO(steven need help): Consult a common list of data types from database driver documentation. e.g. MySQL,PostgreSQL.+ switch v {+ case "VARCHAR", "TEXT", "UUID", "TIMESTAMP":+ scanArgs[i] = new(sql.NullString)+ case "BOOL":+ scanArgs[i] = new(sql.NullBool)+ case "INT", "INTEGER":+ scanArgs[i] = new(sql.NullInt64)+ case "FLOAT":+ scanArgs[i] = new(sql.NullFloat64)+ default:+ scanArgs[i] = new(sql.NullString)+ }+ }++ if err := rows.Scan(scanArgs...); err != nil {+ return nil, err+ }++ var rowData *v1pb.QueryRow+ for i := range columnTypes {+ if len(fieldList) > 0 && fieldList[i].Sensitive {+ rowData.Values = append(rowData.Values, &v1pb.RowValue{Kind: &v1pb.RowValue_StringValue{StringValue: "******"}})+ continue+ }+ if v, ok := (scanArgs[i]).(*sql.NullBool); ok && v.Valid {+ rowData.Values = append(rowData.Values, &v1pb.RowValue{Kind: &v1pb.RowValue_BoolValue{BoolValue: v.Bool}})+ continue+ }+ if v, ok := (scanArgs[i]).(*sql.NullString); ok && v.Valid {+ rowData.Values = append(rowData.Values, &v1pb.RowValue{Kind: &v1pb.RowValue_StringValue{StringValue: v.String}})+ continue+ }+ if v, ok := (scanArgs[i]).(*sql.NullInt64); ok && v.Valid {+ rowData.Values = append(rowData.Values, &v1pb.RowValue{Kind: &v1pb.RowValue_Int64Value{Int64Value: v.Int64}})+ continue+ }+ if v, ok := (scanArgs[i]).(*sql.NullInt32); ok && v.Valid {+ rowData.Values = append(rowData.Values, &v1pb.RowValue{Kind: &v1pb.RowValue_Int32Value{Int32Value: v.Int32}})+ continue+ }+ if v, ok := (scanArgs[i]).(*sql.NullFloat64); ok && v.Valid {+ rowData.Values = append(rowData.Values, &v1pb.RowValue{Kind: &v1pb.RowValue_DoubleValue{DoubleValue: v.Float64}})+ continue+ }+ // If none of them match, set nil to its value.+ rowData.Values = append(rowData.Values, &v1pb.RowValue{Kind: &v1pb.RowValue_NullValue{NullValue: structpb.NullValue_NULL_VALUE}})+ }++ data = append(data, rowData)+ }++ return data, nil+}+func readRows(rows *sql.Rows, dbType db.Type, columnTypes []*sql.ColumnType, columnTypeNames []string, fieldList []db.SensitiveField) ([]any, error) {if dbType == db.ClickHouse {return readRowsForClickhouse(rows, columnTypes, columnTypeNames, fieldList)diff --git a/frontend/src/types/proto/v1/sql_service.ts b/frontend/src/types/proto/v1/sql_service.tsindex 61a4fe7112..d6c7de7491 100644--- a/frontend/src/types/proto/v1/sql_service.ts+++ b/frontend/src/types/proto/v1/sql_service.ts@@ -1,6 +1,8 @@/* eslint-disable */+import * as Long from "long";import type { CallContext, CallOptions } from "nice-grpc-common";import * as _m0 from "protobufjs/minimal";+import { NullValue, nullValueFromJSON, nullValueToJSON } from "../google/protobuf/struct";import { Engine, engineFromJSON, engineToJSON } from "./common";export const protobufPackage = "bytebase.v1";@@ -33,7 +35,10 @@ export interface QueryResponse {export interface QueryResult {/** Column names of the query result. */columnNames: string[];- /** Column types of the query result. */+ /**+ * Column types of the query result.+ * The types come from the Golang SQL driver.+ */columnTypeNames: string[];/** Rows of the query result. */rows: QueryRow[];@@ -45,7 +50,20 @@ export interface QueryResult {export interface QueryRow {/** Row values of the query result. */- values: string[];+ values: RowValue[];+}++export interface RowValue {+ nullValue?: NullValue | undefined;+ boolValue?: boolean | undefined;+ bytesValue?: Uint8Array | undefined;+ doubleValue?: number | undefined;+ floatValue?: number | undefined;+ int32Value?: number | undefined;+ int64Value?: number | undefined;+ stringValue?: string | undefined;+ uint32Value?: number | undefined;+ uint64Value?: number | undefined;}export interface Advice {@@ -448,7 +466,7 @@ function createBaseQueryRow(): QueryRow {export const QueryRow = {encode(message: QueryRow, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {for (const v of message.values) {- writer.uint32(10).string(v!);+ RowValue.encode(v!, writer.uint32(10).fork()).ldelim();}return writer;},@@ -465,7 +483,7 @@ export const QueryRow = {break;}- message.values.push(reader.string());+ message.values.push(RowValue.decode(reader, reader.uint32()));continue;}if ((tag & 7) === 4 || tag === 0) {@@ -477,13 +495,13 @@ export const QueryRow = {},fromJSON(object: any): QueryRow {- return { values: Array.isArray(object?.values) ? object.values.map((e: any) => String(e)) : [] };+ return { values: Array.isArray(object?.values) ? object.values.map((e: any) => RowValue.fromJSON(e)) : [] };},toJSON(message: QueryRow): unknown {const obj: any = {};if (message.values) {- obj.values = message.values.map((e) => e);+ obj.values = message.values.map((e) => e ? RowValue.toJSON(e) : undefined);} else {obj.values = [];}@@ -496,7 +514,195 @@ export const QueryRow = {fromPartial(object: DeepPartial<QueryRow>): QueryRow {const message = createBaseQueryRow();- message.values = object.values?.map((e) => e) || [];+ message.values = object.values?.map((e) => RowValue.fromPartial(e)) || [];+ return message;+ },+};++function createBaseRowValue(): RowValue {+ return {+ nullValue: undefined,+ boolValue: undefined,+ bytesValue: undefined,+ doubleValue: undefined,+ floatValue: undefined,+ int32Value: undefined,+ int64Value: undefined,+ stringValue: undefined,+ uint32Value: undefined,+ uint64Value: undefined,+ };+}++export const RowValue = {+ encode(message: RowValue, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {+ if (message.nullValue !== undefined) {+ writer.uint32(8).int32(message.nullValue);+ }+ if (message.boolValue !== undefined) {+ writer.uint32(16).bool(message.boolValue);+ }+ if (message.bytesValue !== undefined) {+ writer.uint32(26).bytes(message.bytesValue);+ }+ if (message.doubleValue !== undefined) {+ writer.uint32(33).double(message.doubleValue);+ }+ if (message.floatValue !== undefined) {+ writer.uint32(45).float(message.floatValue);+ }+ if (message.int32Value !== undefined) {+ writer.uint32(48).int32(message.int32Value);+ }+ if (message.int64Value !== undefined) {+ writer.uint32(56).int64(message.int64Value);+ }+ if (message.stringValue !== undefined) {+ writer.uint32(66).string(message.stringValue);+ }+ if (message.uint32Value !== undefined) {+ writer.uint32(72).uint32(message.uint32Value);+ }+ if (message.uint64Value !== undefined) {+ writer.uint32(80).uint64(message.uint64Value);+ }+ return writer;+ },++ decode(input: _m0.Reader | Uint8Array, length?: number): RowValue {+ const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);+ let end = length === undefined ? reader.len : reader.pos + length;+ const message = createBaseRowValue();+ while (reader.pos < end) {+ const tag = reader.uint32();+ switch (tag >>> 3) {+ case 1:+ if (tag !== 8) {+ break;+ }++ message.nullValue = reader.int32() as any;+ continue;+ case 2:+ if (tag !== 16) {+ break;+ }++ message.boolValue = reader.bool();+ continue;+ case 3:+ if (tag !== 26) {+ break;+ }++ message.bytesValue = reader.bytes();+ continue;+ case 4:+ if (tag !== 33) {+ break;+ }++ message.doubleValue = reader.double();+ continue;+ case 5:+ if (tag !== 45) {+ break;+ }++ message.floatValue = reader.float();+ continue;+ case 6:+ if (tag !== 48) {+ break;+ }++ message.int32Value = reader.int32();+ continue;+ case 7:+ if (tag !== 56) {+ break;+ }++ message.int64Value = longToNumber(reader.int64() as Long);+ continue;+ case 8:+ if (tag !== 66) {+ break;+ }++ message.stringValue = reader.string();+ continue;+ case 9:+ if (tag !== 72) {+ break;+ }++ message.uint32Value = reader.uint32();+ continue;+ case 10:+ if (tag !== 80) {+ break;+ }++ message.uint64Value = longToNumber(reader.uint64() as Long);+ continue;+ }+ if ((tag & 7) === 4 || tag === 0) {+ break;+ }+ reader.skipType(tag & 7);+ }+ return message;+ },++ fromJSON(object: any): RowValue {+ return {+ nullValue: isSet(object.nullValue) ? nullValueFromJSON(object.nullValue) : undefined,+ boolValue: isSet(object.boolValue) ? Boolean(object.boolValue) : undefined,+ bytesValue: isSet(object.bytesValue) ? bytesFromBase64(object.bytesValue) : undefined,+ doubleValue: isSet(object.doubleValue) ? Number(object.doubleValue) : undefined,+ floatValue: isSet(object.floatValue) ? Number(object.floatValue) : undefined,+ int32Value: isSet(object.int32Value) ? Number(object.int32Value) : undefined,+ int64Value: isSet(object.int64Value) ? Number(object.int64Value) : undefined,+ stringValue: isSet(object.stringValue) ? String(object.stringValue) : undefined,+ uint32Value: isSet(object.uint32Value) ? Number(object.uint32Value) : undefined,+ uint64Value: isSet(object.uint64Value) ? Number(object.uint64Value) : undefined,+ };+ },++ toJSON(message: RowValue): unknown {+ const obj: any = {};+ message.nullValue !== undefined &&+ (obj.nullValue = message.nullValue !== undefined ? nullValueToJSON(message.nullValue) : undefined);+ message.boolValue !== undefined && (obj.boolValue = message.boolValue);+ message.bytesValue !== undefined &&+ (obj.bytesValue = message.bytesValue !== undefined ? base64FromBytes(message.bytesValue) : undefined);+ message.doubleValue !== undefined && (obj.doubleValue = message.doubleValue);+ message.floatValue !== undefined && (obj.floatValue = message.floatValue);+ message.int32Value !== undefined && (obj.int32Value = Math.round(message.int32Value));+ message.int64Value !== undefined && (obj.int64Value = Math.round(message.int64Value));+ message.stringValue !== undefined && (obj.stringValue = message.stringValue);+ message.uint32Value !== undefined && (obj.uint32Value = Math.round(message.uint32Value));+ message.uint64Value !== undefined && (obj.uint64Value = Math.round(message.uint64Value));+ return obj;+ },++ create(base?: DeepPartial<RowValue>): RowValue {+ return RowValue.fromPartial(base ?? {});+ },++ fromPartial(object: DeepPartial<RowValue>): RowValue {+ const message = createBaseRowValue();+ message.nullValue = object.nullValue ?? undefined;+ message.boolValue = object.boolValue ?? undefined;+ message.bytesValue = object.bytesValue ?? undefined;+ message.doubleValue = object.doubleValue ?? undefined;+ message.floatValue = object.floatValue ?? undefined;+ message.int32Value = object.int32Value ?? undefined;+ message.int64Value = object.int64Value ?? undefined;+ message.stringValue = object.stringValue ?? undefined;+ message.uint32Value = object.uint32Value ?? undefined;+ message.uint64Value = object.uint64Value ?? undefined;return message;},};@@ -860,6 +1066,50 @@ export interface SQLServiceClient<CallOptionsExt = {}> {query(request: DeepPartial<QueryRequest>, options?: CallOptions & CallOptionsExt): Promise<QueryResponse>;}+declare var self: any | undefined;+declare var window: any | undefined;+declare var global: any | undefined;+var tsProtoGlobalThis: any = (() => {+ if (typeof globalThis !== "undefined") {+ return globalThis;+ }+ if (typeof self !== "undefined") {+ return self;+ }+ if (typeof window !== "undefined") {+ return window;+ }+ if (typeof global !== "undefined") {+ return global;+ }+ throw "Unable to locate global object";+})();++function bytesFromBase64(b64: string): Uint8Array {+ if (tsProtoGlobalThis.Buffer) {+ return Uint8Array.from(tsProtoGlobalThis.Buffer.from(b64, "base64"));+ } else {+ const bin = tsProtoGlobalThis.atob(b64);+ const arr = new Uint8Array(bin.length);+ for (let i = 0; i < bin.length; ++i) {+ arr[i] = bin.charCodeAt(i);+ }+ return arr;+ }+}++function base64FromBytes(arr: Uint8Array): string {+ if (tsProtoGlobalThis.Buffer) {+ return tsProtoGlobalThis.Buffer.from(arr).toString("base64");+ } else {+ const bin: string[] = [];+ arr.forEach((byte) => {+ bin.push(String.fromCharCode(byte));+ });+ return tsProtoGlobalThis.btoa(bin.join(""));+ }+}+type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;export type DeepPartial<T> = T extends Builtin ? T@@ -867,6 +1117,20 @@ export type DeepPartial<T> = T extends Builtin ? T: T extends {} ? { [K in keyof T]?: DeepPartial<T[K]> }: Partial<T>;+function longToNumber(long: Long): number {+ if (long.gt(Number.MAX_SAFE_INTEGER)) {+ throw new tsProtoGlobalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER");+ }+ return long.toNumber();+}++// If you get a compile-error about 'Constructor<Long> and ... have no overlap',+// add '--ts_proto_opt=esModuleInterop=true' as a flag when calling 'protoc'.+if (_m0.util.Long !== Long) {+ _m0.util.Long = Long as any;+ _m0.configure();+}+function isSet(value: any): boolean {return value !== null && value !== undefined;}diff --git a/proto/gen/grpc-doc/v1/README.md b/proto/gen/grpc-doc/v1/README.mdindex dbc36c865d..f704d44105 100644--- a/proto/gen/grpc-doc/v1/README.md+++ b/proto/gen/grpc-doc/v1/README.md@@ -475,6 +475,7 @@- [QueryResponse](#bytebase-v1-QueryResponse)- [QueryResult](#bytebase-v1-QueryResult)- [QueryRow](#bytebase-v1-QueryRow)+ - [RowValue](#bytebase-v1-RowValue)- [Advice.Status](#bytebase-v1-Advice-Status)@@ -7416,7 +7417,7 @@ The sheet's `name` field is used to identify the sheet to update. Format: pr| Field | Type | Label | Description || ----- | ---- | ----- | ----------- || column_names | [string](#string) | repeated | Column names of the query result. |-| column_type_names | [string](#string) | repeated | Column types of the query result. |+| column_type_names | [string](#string) | repeated | Column types of the query result. The types come from the Golang SQL driver. || rows | [QueryRow](#bytebase-v1-QueryRow) | repeated | Rows of the query result. || masked | [bool](#bool) | repeated | Columns are masked or not. || error | [string](#string) | | The error message if the query failed. |@@ -7434,7 +7435,31 @@ The sheet's `name` field is used to identify the sheet to update. Format: pr| Field | Type | Label | Description || ----- | ---- | ----- | ----------- |-| values | [string](#string) | repeated | Row values of the query result. |+| values | [RowValue](#bytebase-v1-RowValue) | repeated | Row values of the query result. |+++++++<a name="bytebase-v1-RowValue"></a>++### RowValue++++| Field | Type | Label | Description |+| ----- | ---- | ----- | ----------- |+| null_value | [google.protobuf.NullValue](#google-protobuf-NullValue) | | |+| bool_value | [bool](#bool) | | |+| bytes_value | [bytes](#bytes) | | |+| double_value | [double](#double) | | |+| float_value | [float](#float) | | |+| int32_value | [int32](#int32) | | |+| int64_value | [int64](#int64) | | |+| string_value | [string](#string) | | |+| uint32_value | [uint32](#uint32) | | |+| uint64_value | [uint64](#uint64) | | |diff --git a/proto/generated-go/v1/sql_service.pb.go b/proto/generated-go/v1/sql_service.pb.goindex 13ce553db9..1341d7ce66 100644--- a/proto/generated-go/v1/sql_service.pb.go+++ b/proto/generated-go/v1/sql_service.pb.go@@ -10,6 +10,7 @@ import (_ "google.golang.org/genproto/googleapis/api/annotations"protoreflect "google.golang.org/protobuf/reflect/protoreflect"protoimpl "google.golang.org/protobuf/runtime/protoimpl"+ structpb "google.golang.org/protobuf/types/known/structpb"reflect "reflect"sync "sync")@@ -71,7 +72,7 @@ func (x Advice_Status) Number() protoreflect.EnumNumber {// Deprecated: Use Advice_Status.Descriptor instead.func (Advice_Status) EnumDescriptor() ([]byte, []int) {- return file_v1_sql_service_proto_rawDescGZIP(), []int{4, 0}+ return file_v1_sql_service_proto_rawDescGZIP(), []int{5, 0}}type QueryRequest struct {@@ -217,6 +218,7 @@ type QueryResult struct {// Column names of the query result.ColumnNames []string `protobuf:"bytes,1,rep,name=column_names,json=columnNames,proto3" json:"column_names,omitempty"`// Column types of the query result.+ // The types come from the Golang SQL driver.ColumnTypeNames []string `protobuf:"bytes,2,rep,name=column_type_names,json=columnTypeNames,proto3" json:"column_type_names,omitempty"`// Rows of the query result.Rows []*QueryRow `protobuf:"bytes,3,rep,name=rows,proto3" json:"rows,omitempty"`@@ -299,7 +301,7 @@ type QueryRow struct {unknownFields protoimpl.UnknownFields// Row values of the query result.- Values []string `protobuf:"bytes,1,rep,name=values,proto3" json:"values,omitempty"`+ Values []*RowValue `protobuf:"bytes,1,rep,name=values,proto3" json:"values,omitempty"`}func (x *QueryRow) Reset() {@@ -334,13 +336,206 @@ func (*QueryRow) Descriptor() ([]byte, []int) {return file_v1_sql_service_proto_rawDescGZIP(), []int{3}}-func (x *QueryRow) GetValues() []string {+func (x *QueryRow) GetValues() []*RowValue {if x != nil {return x.Values}return nil}+type RowValue struct {+ state protoimpl.MessageState+ sizeCache protoimpl.SizeCache+ unknownFields protoimpl.UnknownFields++ // Types that are assignable to Kind:+ //+ // *RowValue_NullValue+ // *RowValue_BoolValue+ // *RowValue_BytesValue+ // *RowValue_DoubleValue+ // *RowValue_FloatValue+ // *RowValue_Int32Value+ // *RowValue_Int64Value+ // *RowValue_StringValue+ // *RowValue_Uint32Value+ // *RowValue_Uint64Value+ Kind isRowValue_Kind `protobuf_oneof:"kind"`+}++func (x *RowValue) Reset() {+ *x = RowValue{}+ if protoimpl.UnsafeEnabled {+ mi := &file_v1_sql_service_proto_msgTypes[4]+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))+ ms.StoreMessageInfo(mi)+ }+}++func (x *RowValue) String() string {+ return protoimpl.X.MessageStringOf(x)+}++func (*RowValue) ProtoMessage() {}++func (x *RowValue) ProtoReflect() protoreflect.Message {+ mi := &file_v1_sql_service_proto_msgTypes[4]+ if protoimpl.UnsafeEnabled && x != nil {+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))+ if ms.LoadMessageInfo() == nil {+ ms.StoreMessageInfo(mi)+ }+ return ms+ }+ return mi.MessageOf(x)+}++// Deprecated: Use RowValue.ProtoReflect.Descriptor instead.+func (*RowValue) Descriptor() ([]byte, []int) {+ return file_v1_sql_service_proto_rawDescGZIP(), []int{4}+}++func (m *RowValue) GetKind() isRowValue_Kind {+ if m != nil {+ return m.Kind+ }+ return nil+}++func (x *RowValue) GetNullValue() structpb.NullValue {+ if x, ok := x.GetKind().(*RowValue_NullValue); ok {+ return x.NullValue+ }+ return structpb.NullValue(0)+}++func (x *RowValue) GetBoolValue() bool {+ if x, ok := x.GetKind().(*RowValue_BoolValue); ok {+ return x.BoolValue+ }+ return false+}++func (x *RowValue) GetBytesValue() []byte {+ if x, ok := x.GetKind().(*RowValue_BytesValue); ok {+ return x.BytesValue+ }+ return nil+}++func (x *RowValue) GetDoubleValue() float64 {+ if x, ok := x.GetKind().(*RowValue_DoubleValue); ok {+ return x.DoubleValue+ }+ return 0+}++func (x *RowValue) GetFloatValue() float32 {+ if x, ok := x.GetKind().(*RowValue_FloatValue); ok {+ return x.FloatValue+ }+ return 0+}++func (x *RowValue) GetInt32Value() int32 {+ if x, ok := x.GetKind().(*RowValue_Int32Value); ok {+ return x.Int32Value+ }+ return 0+}++func (x *RowValue) GetInt64Value() int64 {+ if x, ok := x.GetKind().(*RowValue_Int64Value); ok {+ return x.Int64Value+ }+ return 0+}++func (x *RowValue) GetStringValue() string {+ if x, ok := x.GetKind().(*RowValue_StringValue); ok {+ return x.StringValue+ }+ return ""+}++func (x *RowValue) GetUint32Value() uint32 {+ if x, ok := x.GetKind().(*RowValue_Uint32Value); ok {+ return x.Uint32Value+ }+ return 0+}++func (x *RowValue) GetUint64Value() uint64 {+ if x, ok := x.GetKind().(*RowValue_Uint64Value); ok {+ return x.Uint64Value+ }+ return 0+}++type isRowValue_Kind interface {+ isRowValue_Kind()+}++type RowValue_NullValue struct {+ NullValue structpb.NullValue `protobuf:"varint,1,opt,name=null_value,json=nullValue,proto3,enum=google.protobuf.NullValue,oneof"`+}++type RowValue_BoolValue struct {+ BoolValue bool `protobuf:"varint,2,opt,name=bool_value,json=boolValue,proto3,oneof"`+}++type RowValue_BytesValue struct {+ BytesValue []byte `protobuf:"bytes,3,opt,name=bytes_value,json=bytesValue,proto3,oneof"`+}++type RowValue_DoubleValue struct {+ DoubleValue float64 `protobuf:"fixed64,4,opt,name=double_value,json=doubleValue,proto3,oneof"`+}++type RowValue_FloatValue struct {+ FloatValue float32 `protobuf:"fixed32,5,opt,name=float_value,json=floatValue,proto3,oneof"`+}++type RowValue_Int32Value struct {+ Int32Value int32 `protobuf:"varint,6,opt,name=int32_value,json=int32Value,proto3,oneof"`+}++type RowValue_Int64Value struct {+ Int64Value int64 `protobuf:"varint,7,opt,name=int64_value,json=int64Value,proto3,oneof"`+}++type RowValue_StringValue struct {+ StringValue string `protobuf:"bytes,8,opt,name=string_value,json=stringValue,proto3,oneof"`+}++type RowValue_Uint32Value struct {+ Uint32Value uint32 `protobuf:"varint,9,opt,name=uint32_value,json=uint32Value,proto3,oneof"`+}++type RowValue_Uint64Value struct {+ Uint64Value uint64 `protobuf:"varint,10,opt,name=uint64_value,json=uint64Value,proto3,oneof"`+}++func (*RowValue_NullValue) isRowValue_Kind() {}++func (*RowValue_BoolValue) isRowValue_Kind() {}++func (*RowValue_BytesValue) isRowValue_Kind() {}++func (*RowValue_DoubleValue) isRowValue_Kind() {}++func (*RowValue_FloatValue) isRowValue_Kind() {}++func (*RowValue_Int32Value) isRowValue_Kind() {}++func (*RowValue_Int64Value) isRowValue_Kind() {}++func (*RowValue_StringValue) isRowValue_Kind() {}++func (*RowValue_Uint32Value) isRowValue_Kind() {}++func (*RowValue_Uint64Value) isRowValue_Kind() {}+type Advice struct {state protoimpl.MessageStatesizeCache protoimpl.SizeCache@@ -363,7 +558,7 @@ type Advice struct {func (x *Advice) Reset() {*x = Advice{}if protoimpl.UnsafeEnabled {- mi := &file_v1_sql_service_proto_msgTypes[4]+ mi := &file_v1_sql_service_proto_msgTypes[5]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -376,7 +571,7 @@ func (x *Advice) String() string {func (*Advice) ProtoMessage() {}func (x *Advice) ProtoReflect() protoreflect.Message {- mi := &file_v1_sql_service_proto_msgTypes[4]+ mi := &file_v1_sql_service_proto_msgTypes[5]if protoimpl.UnsafeEnabled && x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -389,7 +584,7 @@ func (x *Advice) ProtoReflect() protoreflect.Message {// Deprecated: Use Advice.ProtoReflect.Descriptor instead.func (*Advice) Descriptor() ([]byte, []int) {- return file_v1_sql_service_proto_rawDescGZIP(), []int{4}+ return file_v1_sql_service_proto_rawDescGZIP(), []int{5}}func (x *Advice) GetStatus() Advice_Status {@@ -450,7 +645,7 @@ type PrettyRequest struct {func (x *PrettyRequest) Reset() {*x = PrettyRequest{}if protoimpl.UnsafeEnabled {- mi := &file_v1_sql_service_proto_msgTypes[5]+ mi := &file_v1_sql_service_proto_msgTypes[6]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -463,7 +658,7 @@ func (x *PrettyRequest) String() string {func (*PrettyRequest) ProtoMessage() {}func (x *PrettyRequest) ProtoReflect() protoreflect.Message {- mi := &file_v1_sql_service_proto_msgTypes[5]+ mi := &file_v1_sql_service_proto_msgTypes[6]if protoimpl.UnsafeEnabled && x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -476,7 +671,7 @@ func (x *PrettyRequest) ProtoReflect() protoreflect.Message {// Deprecated: Use PrettyRequest.ProtoReflect.Descriptor instead.func (*PrettyRequest) Descriptor() ([]byte, []int) {- return file_v1_sql_service_proto_rawDescGZIP(), []int{5}+ return file_v1_sql_service_proto_rawDescGZIP(), []int{6}}func (x *PrettyRequest) GetEngine() Engine {@@ -514,7 +709,7 @@ type PrettyResponse struct {func (x *PrettyResponse) Reset() {*x = PrettyResponse{}if protoimpl.UnsafeEnabled {- mi := &file_v1_sql_service_proto_msgTypes[6]+ mi := &file_v1_sql_service_proto_msgTypes[7]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -527,7 +722,7 @@ func (x *PrettyResponse) String() string {func (*PrettyResponse) ProtoMessage() {}func (x *PrettyResponse) ProtoReflect() protoreflect.Message {- mi := &file_v1_sql_service_proto_msgTypes[6]+ mi := &file_v1_sql_service_proto_msgTypes[7]if protoimpl.UnsafeEnabled && x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -540,7 +735,7 @@ func (x *PrettyResponse) ProtoReflect() protoreflect.Message {// Deprecated: Use PrettyResponse.ProtoReflect.Descriptor instead.func (*PrettyResponse) Descriptor() ([]byte, []int) {- return file_v1_sql_service_proto_rawDescGZIP(), []int{6}+ return file_v1_sql_service_proto_rawDescGZIP(), []int{7}}func (x *PrettyResponse) GetCurrentSchema() string {@@ -566,83 +761,112 @@ var file_v1_sql_service_proto_rawDesc = []byte{0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74,0x6f, 0x1a, 0x1f, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x66, 0x69,0x65, 0x6c, 0x64, 0x5f, 0x62, 0x65, 0x68, 0x61, 0x76, 0x69, 0x6f, 0x72, 0x2e, 0x70, 0x72, 0x6f,- 0x74, 0x6f, 0x1a, 0x0f, 0x76, 0x31, 0x2f, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x70, 0x72,- 0x6f, 0x74, 0x6f, 0x22, 0x8c, 0x01, 0x0a, 0x0c, 0x51, 0x75, 0x65, 0x72, 0x79, 0x52, 0x65, 0x71,- 0x75, 0x65, 0x73, 0x74, 0x12, 0x17, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01,- 0x28, 0x09, 0x42, 0x03, 0xe0, 0x41, 0x02, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x2f, 0x0a,- 0x13, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x64, 0x61, 0x74, 0x61,- 0x62, 0x61, 0x73, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x12, 0x63, 0x6f, 0x6e, 0x6e,- 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x44, 0x61, 0x74, 0x61, 0x62, 0x61, 0x73, 0x65, 0x12, 0x1c,- 0x0a, 0x09, 0x73, 0x74, 0x61, 0x74, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28,- 0x09, 0x52, 0x09, 0x73, 0x74, 0x61, 0x74, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x14, 0x0a, 0x05,- 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x6c, 0x69, 0x6d,- 0x69, 0x74, 0x22, 0x72, 0x0a, 0x0d, 0x51, 0x75, 0x65, 0x72, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f,- 0x6e, 0x73, 0x65, 0x12, 0x32, 0x0a, 0x07, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x73, 0x18, 0x01,- 0x20, 0x03, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e,- 0x76, 0x31, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x52, 0x07,- 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x73, 0x12, 0x2d, 0x0a, 0x07, 0x61, 0x64, 0x76, 0x69, 0x63,- 0x65, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62,- 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x41, 0x64, 0x76, 0x69, 0x63, 0x65, 0x52, 0x07, 0x61,- 0x64, 0x76, 0x69, 0x63, 0x65, 0x73, 0x22, 0xb5, 0x01, 0x0a, 0x0b, 0x51, 0x75, 0x65, 0x72, 0x79,- 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x12, 0x21, 0x0a, 0x0c, 0x63, 0x6f, 0x6c, 0x75, 0x6d, 0x6e,- 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0b, 0x63, 0x6f,- 0x6c, 0x75, 0x6d, 0x6e, 0x4e, 0x61, 0x6d, 0x65, 0x73, 0x12, 0x2a, 0x0a, 0x11, 0x63, 0x6f, 0x6c,- 0x75, 0x6d, 0x6e, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x18, 0x02,- 0x20, 0x03, 0x28, 0x09, 0x52, 0x0f, 0x63, 0x6f, 0x6c, 0x75, 0x6d, 0x6e, 0x54, 0x79, 0x70, 0x65,- 0x4e, 0x61, 0x6d, 0x65, 0x73, 0x12, 0x29, 0x0a, 0x04, 0x72, 0x6f, 0x77, 0x73, 0x18, 0x03, 0x20,- 0x03, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76,- 0x31, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x52, 0x6f, 0x77, 0x52, 0x04, 0x72, 0x6f, 0x77, 0x73,- 0x12, 0x16, 0x0a, 0x06, 0x6d, 0x61, 0x73, 0x6b, 0x65, 0x64, 0x18, 0x04, 0x20, 0x03, 0x28, 0x08,- 0x52, 0x06, 0x6d, 0x61, 0x73, 0x6b, 0x65, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x72, 0x72, 0x6f,- 0x72, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x22, 0x22,- 0x0a, 0x08, 0x51, 0x75, 0x65, 0x72, 0x79, 0x52, 0x6f, 0x77, 0x12, 0x16, 0x0a, 0x06, 0x76, 0x61,- 0x6c, 0x75, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75,- 0x65, 0x73, 0x22, 0xf3, 0x01, 0x0a, 0x06, 0x41, 0x64, 0x76, 0x69, 0x63, 0x65, 0x12, 0x32, 0x0a,- 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1a, 0x2e,- 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x41, 0x64, 0x76, 0x69,- 0x63, 0x65, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75,- 0x73, 0x12, 0x12, 0x0a, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52,- 0x04, 0x63, 0x6f, 0x64, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x18, 0x03,- 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x63,- 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x6f,- 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x6c, 0x69, 0x6e, 0x65, 0x18, 0x05, 0x20,- 0x01, 0x28, 0x05, 0x52, 0x04, 0x6c, 0x69, 0x6e, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x64, 0x65, 0x74,- 0x61, 0x69, 0x6c, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x64, 0x65, 0x74, 0x61, 0x69,- 0x6c, 0x22, 0x45, 0x0a, 0x06, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x16, 0x0a, 0x12, 0x53,- 0x54, 0x41, 0x54, 0x55, 0x53, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45,- 0x44, 0x10, 0x00, 0x12, 0x0b, 0x0a, 0x07, 0x53, 0x55, 0x43, 0x43, 0x45, 0x53, 0x53, 0x10, 0x01,- 0x12, 0x0b, 0x0a, 0x07, 0x57, 0x41, 0x52, 0x4e, 0x49, 0x4e, 0x47, 0x10, 0x02, 0x12, 0x09, 0x0a,- 0x05, 0x45, 0x52, 0x52, 0x4f, 0x52, 0x10, 0x03, 0x22, 0x8c, 0x01, 0x0a, 0x0d, 0x50, 0x72, 0x65,- 0x74, 0x74, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x2b, 0x0a, 0x06, 0x65, 0x6e,- 0x67, 0x69, 0x6e, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x13, 0x2e, 0x62, 0x79, 0x74,- 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x45, 0x6e, 0x67, 0x69, 0x6e, 0x65, 0x52,- 0x06, 0x65, 0x6e, 0x67, 0x69, 0x6e, 0x65, 0x12, 0x25, 0x0a, 0x0e, 0x63, 0x75, 0x72, 0x72, 0x65,- 0x6e, 0x74, 0x5f, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52,- 0x0d, 0x63, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x74, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x12, 0x27,- 0x0a, 0x0f, 0x65, 0x78, 0x70, 0x65, 0x63, 0x74, 0x65, 0x64, 0x5f, 0x73, 0x63, 0x68, 0x65, 0x6d,- 0x61, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x65, 0x78, 0x70, 0x65, 0x63, 0x74, 0x65,- 0x64, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x22, 0x60, 0x0a, 0x0e, 0x50, 0x72, 0x65, 0x74, 0x74,- 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x25, 0x0a, 0x0e, 0x63, 0x75, 0x72,- 0x72, 0x65, 0x6e, 0x74, 0x5f, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28,- 0x09, 0x52, 0x0d, 0x63, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x74, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61,- 0x12, 0x27, 0x0a, 0x0f, 0x65, 0x78, 0x70, 0x65, 0x63, 0x74, 0x65, 0x64, 0x5f, 0x73, 0x63, 0x68,- 0x65, 0x6d, 0x61, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x65, 0x78, 0x70, 0x65, 0x63,- 0x74, 0x65, 0x64, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x32, 0xd3, 0x01, 0x0a, 0x0a, 0x53, 0x51,- 0x4c, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x5c, 0x0a, 0x06, 0x50, 0x72, 0x65, 0x74,- 0x74, 0x79, 0x12, 0x1a, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31,- 0x2e, 0x50, 0x72, 0x65, 0x74, 0x74, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1b,- 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x50, 0x72, 0x65,- 0x74, 0x74, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x19, 0x82, 0xd3, 0xe4,- 0x93, 0x02, 0x13, 0x3a, 0x01, 0x2a, 0x22, 0x0e, 0x2f, 0x76, 0x31, 0x2f, 0x73, 0x71, 0x6c, 0x2f,- 0x70, 0x72, 0x65, 0x74, 0x74, 0x79, 0x12, 0x67, 0x0a, 0x05, 0x51, 0x75, 0x65, 0x72, 0x79, 0x12,- 0x19, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x51, 0x75,- 0x65, 0x72, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1a, 0x2e, 0x62, 0x79, 0x74,- 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x52, 0x65,- 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x27, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x21, 0x3a, 0x01,- 0x2a, 0x22, 0x1c, 0x2f, 0x76, 0x31, 0x2f, 0x7b, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x69, 0x6e, 0x73,- 0x74, 0x61, 0x6e, 0x63, 0x65, 0x73, 0x2f, 0x2a, 0x7d, 0x3a, 0x71, 0x75, 0x65, 0x72, 0x79, 0x42,- 0x11, 0x5a, 0x0f, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x2d, 0x67, 0x6f, 0x2f,- 0x76, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,+ 0x74, 0x6f, 0x1a, 0x1c, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f,+ 0x62, 0x75, 0x66, 0x2f, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f,+ 0x1a, 0x0f, 0x76, 0x31, 0x2f, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74,+ 0x6f, 0x22, 0x8c, 0x01, 0x0a, 0x0c, 0x51, 0x75, 0x65, 0x72, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65,+ 0x73, 0x74, 0x12, 0x17, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09,+ 0x42, 0x03, 0xe0, 0x41, 0x02, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x2f, 0x0a, 0x13, 0x63,+ 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x64, 0x61, 0x74, 0x61, 0x62, 0x61,+ 0x73, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x12, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63,+ 0x74, 0x69, 0x6f, 0x6e, 0x44, 0x61, 0x74, 0x61, 0x62, 0x61, 0x73, 0x65, 0x12, 0x1c, 0x0a, 0x09,+ 0x73, 0x74, 0x61, 0x74, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52,+ 0x09, 0x73, 0x74, 0x61, 0x74, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x6c, 0x69,+ 0x6d, 0x69, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x6c, 0x69, 0x6d, 0x69, 0x74,+ 0x22, 0x72, 0x0a, 0x0d, 0x51, 0x75, 0x65, 0x72, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73,+ 0x65, 0x12, 0x32, 0x0a, 0x07, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x73, 0x18, 0x01, 0x20, 0x03,+ 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31,+ 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x52, 0x07, 0x72, 0x65,+ 0x73, 0x75, 0x6c, 0x74, 0x73, 0x12, 0x2d, 0x0a, 0x07, 0x61, 0x64, 0x76, 0x69, 0x63, 0x65, 0x73,+ 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73,+ 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x41, 0x64, 0x76, 0x69, 0x63, 0x65, 0x52, 0x07, 0x61, 0x64, 0x76,+ 0x69, 0x63, 0x65, 0x73, 0x22, 0xb5, 0x01, 0x0a, 0x0b, 0x51, 0x75, 0x65, 0x72, 0x79, 0x52, 0x65,+ 0x73, 0x75, 0x6c, 0x74, 0x12, 0x21, 0x0a, 0x0c, 0x63, 0x6f, 0x6c, 0x75, 0x6d, 0x6e, 0x5f, 0x6e,+ 0x61, 0x6d, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0b, 0x63, 0x6f, 0x6c, 0x75,+ 0x6d, 0x6e, 0x4e, 0x61, 0x6d, 0x65, 0x73, 0x12, 0x2a, 0x0a, 0x11, 0x63, 0x6f, 0x6c, 0x75, 0x6d,+ 0x6e, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x18, 0x02, 0x20, 0x03,+ 0x28, 0x09, 0x52, 0x0f, 0x63, 0x6f, 0x6c, 0x75, 0x6d, 0x6e, 0x54, 0x79, 0x70, 0x65, 0x4e, 0x61,+ 0x6d, 0x65, 0x73, 0x12, 0x29, 0x0a, 0x04, 0x72, 0x6f, 0x77, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28,+ 0x0b, 0x32, 0x15, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e,+ 0x51, 0x75, 0x65, 0x72, 0x79, 0x52, 0x6f, 0x77, 0x52, 0x04, 0x72, 0x6f, 0x77, 0x73, 0x12, 0x16,+ 0x0a, 0x06, 0x6d, 0x61, 0x73, 0x6b, 0x65, 0x64, 0x18, 0x04, 0x20, 0x03, 0x28, 0x08, 0x52, 0x06,+ 0x6d, 0x61, 0x73, 0x6b, 0x65, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x18,+ 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x22, 0x39, 0x0a, 0x08,+ 0x51, 0x75, 0x65, 0x72, 0x79, 0x52, 0x6f, 0x77, 0x12, 0x2d, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75,+ 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62,+ 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x52, 0x6f, 0x77, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52,+ 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x22, 0x90, 0x03, 0x0a, 0x08, 0x52, 0x6f, 0x77, 0x56,+ 0x61, 0x6c, 0x75, 0x65, 0x12, 0x3b, 0x0a, 0x0a, 0x6e, 0x75, 0x6c, 0x6c, 0x5f, 0x76, 0x61, 0x6c,+ 0x75, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c,+ 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x4e, 0x75, 0x6c, 0x6c, 0x56,+ 0x61, 0x6c, 0x75, 0x65, 0x48, 0x00, 0x52, 0x09, 0x6e, 0x75, 0x6c, 0x6c, 0x56, 0x61, 0x6c, 0x75,+ 0x65, 0x12, 0x1f, 0x0a, 0x0a, 0x62, 0x6f, 0x6f, 0x6c, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18,+ 0x02, 0x20, 0x01, 0x28, 0x08, 0x48, 0x00, 0x52, 0x09, 0x62, 0x6f, 0x6f, 0x6c, 0x56, 0x61, 0x6c,+ 0x75, 0x65, 0x12, 0x21, 0x0a, 0x0b, 0x62, 0x79, 0x74, 0x65, 0x73, 0x5f, 0x76, 0x61, 0x6c, 0x75,+ 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x48, 0x00, 0x52, 0x0a, 0x62, 0x79, 0x74, 0x65, 0x73,+ 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x23, 0x0a, 0x0c, 0x64, 0x6f, 0x75, 0x62, 0x6c, 0x65, 0x5f,+ 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x01, 0x48, 0x00, 0x52, 0x0b, 0x64,+ 0x6f, 0x75, 0x62, 0x6c, 0x65, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x21, 0x0a, 0x0b, 0x66, 0x6c,+ 0x6f, 0x61, 0x74, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x02, 0x48,+ 0x00, 0x52, 0x0a, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x21, 0x0a,+ 0x0b, 0x69, 0x6e, 0x74, 0x33, 0x32, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x06, 0x20, 0x01,+ 0x28, 0x05, 0x48, 0x00, 0x52, 0x0a, 0x69, 0x6e, 0x74, 0x33, 0x32, 0x56, 0x61, 0x6c, 0x75, 0x65,+ 0x12, 0x21, 0x0a, 0x0b, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18,+ 0x07, 0x20, 0x01, 0x28, 0x03, 0x48, 0x00, 0x52, 0x0a, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x56, 0x61,+ 0x6c, 0x75, 0x65, 0x12, 0x23, 0x0a, 0x0c, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x5f, 0x76, 0x61,+ 0x6c, 0x75, 0x65, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x0b, 0x73, 0x74, 0x72,+ 0x69, 0x6e, 0x67, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x23, 0x0a, 0x0c, 0x75, 0x69, 0x6e, 0x74,+ 0x33, 0x32, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x09, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x00,+ 0x52, 0x0b, 0x75, 0x69, 0x6e, 0x74, 0x33, 0x32, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x23, 0x0a,+ 0x0c, 0x75, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x0a, 0x20,+ 0x01, 0x28, 0x04, 0x48, 0x00, 0x52, 0x0b, 0x75, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x56, 0x61, 0x6c,+ 0x75, 0x65, 0x42, 0x06, 0x0a, 0x04, 0x6b, 0x69, 0x6e, 0x64, 0x22, 0xf3, 0x01, 0x0a, 0x06, 0x41,+ 0x64, 0x76, 0x69, 0x63, 0x65, 0x12, 0x32, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18,+ 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1a, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65,+ 0x2e, 0x76, 0x31, 0x2e, 0x41, 0x64, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75,+ 0x73, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x12, 0x0a, 0x04, 0x63, 0x6f, 0x64,+ 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x12, 0x14, 0x0a,+ 0x05, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x74, 0x69,+ 0x74, 0x6c, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x18, 0x04,+ 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x12, 0x12, 0x0a,+ 0x04, 0x6c, 0x69, 0x6e, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x6c, 0x69, 0x6e,+ 0x65, 0x12, 0x16, 0x0a, 0x06, 0x64, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x18, 0x06, 0x20, 0x01, 0x28,+ 0x09, 0x52, 0x06, 0x64, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x22, 0x45, 0x0a, 0x06, 0x53, 0x74, 0x61,+ 0x74, 0x75, 0x73, 0x12, 0x16, 0x0a, 0x12, 0x53, 0x54, 0x41, 0x54, 0x55, 0x53, 0x5f, 0x55, 0x4e,+ 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x0b, 0x0a, 0x07, 0x53,+ 0x55, 0x43, 0x43, 0x45, 0x53, 0x53, 0x10, 0x01, 0x12, 0x0b, 0x0a, 0x07, 0x57, 0x41, 0x52, 0x4e,+ 0x49, 0x4e, 0x47, 0x10, 0x02, 0x12, 0x09, 0x0a, 0x05, 0x45, 0x52, 0x52, 0x4f, 0x52, 0x10, 0x03,+ 0x22, 0x8c, 0x01, 0x0a, 0x0d, 0x50, 0x72, 0x65, 0x74, 0x74, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65,+ 0x73, 0x74, 0x12, 0x2b, 0x0a, 0x06, 0x65, 0x6e, 0x67, 0x69, 0x6e, 0x65, 0x18, 0x01, 0x20, 0x01,+ 0x28, 0x0e, 0x32, 0x13, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31,+ 0x2e, 0x45, 0x6e, 0x67, 0x69, 0x6e, 0x65, 0x52, 0x06, 0x65, 0x6e, 0x67, 0x69, 0x6e, 0x65, 0x12,+ 0x25, 0x0a, 0x0e, 0x63, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x74, 0x5f, 0x73, 0x63, 0x68, 0x65, 0x6d,+ 0x61, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x63, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x74,+ 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x12, 0x27, 0x0a, 0x0f, 0x65, 0x78, 0x70, 0x65, 0x63, 0x74,+ 0x65, 0x64, 0x5f, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52,+ 0x0e, 0x65, 0x78, 0x70, 0x65, 0x63, 0x74, 0x65, 0x64, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x22,+ 0x60, 0x0a, 0x0e, 0x50, 0x72, 0x65, 0x74, 0x74, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73,+ 0x65, 0x12, 0x25, 0x0a, 0x0e, 0x63, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x74, 0x5f, 0x73, 0x63, 0x68,+ 0x65, 0x6d, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x63, 0x75, 0x72, 0x72, 0x65,+ 0x6e, 0x74, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x12, 0x27, 0x0a, 0x0f, 0x65, 0x78, 0x70, 0x65,+ 0x63, 0x74, 0x65, 0x64, 0x5f, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x18, 0x02, 0x20, 0x01, 0x28,+ 0x09, 0x52, 0x0e, 0x65, 0x78, 0x70, 0x65, 0x63, 0x74, 0x65, 0x64, 0x53, 0x63, 0x68, 0x65, 0x6d,+ 0x61, 0x32, 0xd3, 0x01, 0x0a, 0x0a, 0x53, 0x51, 0x4c, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65,+ 0x12, 0x5c, 0x0a, 0x06, 0x50, 0x72, 0x65, 0x74, 0x74, 0x79, 0x12, 0x1a, 0x2e, 0x62, 0x79, 0x74,+ 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x50, 0x72, 0x65, 0x74, 0x74, 0x79, 0x52,+ 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1b, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73,+ 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x50, 0x72, 0x65, 0x74, 0x74, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f,+ 0x6e, 0x73, 0x65, 0x22, 0x19, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x13, 0x3a, 0x01, 0x2a, 0x22, 0x0e,+ 0x2f, 0x76, 0x31, 0x2f, 0x73, 0x71, 0x6c, 0x2f, 0x70, 0x72, 0x65, 0x74, 0x74, 0x79, 0x12, 0x67,+ 0x0a, 0x05, 0x51, 0x75, 0x65, 0x72, 0x79, 0x12, 0x19, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61,+ 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65,+ 0x73, 0x74, 0x1a, 0x1a, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31,+ 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x27,+ 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x21, 0x3a, 0x01, 0x2a, 0x22, 0x1c, 0x2f, 0x76, 0x31, 0x2f, 0x7b,+ 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x73, 0x2f, 0x2a,+ 0x7d, 0x3a, 0x71, 0x75, 0x65, 0x72, 0x79, 0x42, 0x11, 0x5a, 0x0f, 0x67, 0x65, 0x6e, 0x65, 0x72,+ 0x61, 0x74, 0x65, 0x64, 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74,+ 0x6f, 0x33,}var (@@ -658,33 +882,37 @@ func file_v1_sql_service_proto_rawDescGZIP() []byte {}var file_v1_sql_service_proto_enumTypes = make([]protoimpl.EnumInfo, 1)-var file_v1_sql_service_proto_msgTypes = make([]protoimpl.MessageInfo, 7)+var file_v1_sql_service_proto_msgTypes = make([]protoimpl.MessageInfo, 8)var file_v1_sql_service_proto_goTypes = []interface{}{- (Advice_Status)(0), // 0: bytebase.v1.Advice.Status- (*QueryRequest)(nil), // 1: bytebase.v1.QueryRequest- (*QueryResponse)(nil), // 2: bytebase.v1.QueryResponse- (*QueryResult)(nil), // 3: bytebase.v1.QueryResult- (*QueryRow)(nil), // 4: bytebase.v1.QueryRow- (*Advice)(nil), // 5: bytebase.v1.Advice- (*PrettyRequest)(nil), // 6: bytebase.v1.PrettyRequest- (*PrettyResponse)(nil), // 7: bytebase.v1.PrettyResponse- (Engine)(0), // 8: bytebase.v1.Engine+ (Advice_Status)(0), // 0: bytebase.v1.Advice.Status+ (*QueryRequest)(nil), // 1: bytebase.v1.QueryRequest+ (*QueryResponse)(nil), // 2: bytebase.v1.QueryResponse+ (*QueryResult)(nil), // 3: bytebase.v1.QueryResult+ (*QueryRow)(nil), // 4: bytebase.v1.QueryRow+ (*RowValue)(nil), // 5: bytebase.v1.RowValue+ (*Advice)(nil), // 6: bytebase.v1.Advice+ (*PrettyRequest)(nil), // 7: bytebase.v1.PrettyRequest+ (*PrettyResponse)(nil), // 8: bytebase.v1.PrettyResponse+ (structpb.NullValue)(0), // 9: google.protobuf.NullValue+ (Engine)(0), // 10: bytebase.v1.Engine}var file_v1_sql_service_proto_depIdxs = []int32{- 3, // 0: bytebase.v1.QueryResponse.results:type_name -> bytebase.v1.QueryResult- 5, // 1: bytebase.v1.QueryResponse.advices:type_name -> bytebase.v1.Advice- 4, // 2: bytebase.v1.QueryResult.rows:type_name -> bytebase.v1.QueryRow- 0, // 3: bytebase.v1.Advice.status:type_name -> bytebase.v1.Advice.Status- 8, // 4: bytebase.v1.PrettyRequest.engine:type_name -> bytebase.v1.Engine- 6, // 5: bytebase.v1.SQLService.Pretty:input_type -> bytebase.v1.PrettyRequest- 1, // 6: bytebase.v1.SQLService.Query:input_type -> bytebase.v1.QueryRequest- 7, // 7: bytebase.v1.SQLService.Pretty:output_type -> bytebase.v1.PrettyResponse- 2, // 8: bytebase.v1.SQLService.Query:output_type -> bytebase.v1.QueryResponse- 7, // [7:9] is the sub-list for method output_type- 5, // [5:7] is the sub-list for method input_type- 5, // [5:5] is the sub-list for extension type_name- 5, // [5:5] is the sub-list for extension extendee- 0, // [0:5] is the sub-list for field type_name+ 3, // 0: bytebase.v1.QueryResponse.results:type_name -> bytebase.v1.QueryResult+ 6, // 1: bytebase.v1.QueryResponse.advices:type_name -> bytebase.v1.Advice+ 4, // 2: bytebase.v1.QueryResult.rows:type_name -> bytebase.v1.QueryRow+ 5, // 3: bytebase.v1.QueryRow.values:type_name -> bytebase.v1.RowValue+ 9, // 4: bytebase.v1.RowValue.null_value:type_name -> google.protobuf.NullValue+ 0, // 5: bytebase.v1.Advice.status:type_name -> bytebase.v1.Advice.Status+ 10, // 6: bytebase.v1.PrettyRequest.engine:type_name -> bytebase.v1.Engine+ 7, // 7: bytebase.v1.SQLService.Pretty:input_type -> bytebase.v1.PrettyRequest+ 1, // 8: bytebase.v1.SQLService.Query:input_type -> bytebase.v1.QueryRequest+ 8, // 9: bytebase.v1.SQLService.Pretty:output_type -> bytebase.v1.PrettyResponse+ 2, // 10: bytebase.v1.SQLService.Query:output_type -> bytebase.v1.QueryResponse+ 9, // [9:11] is the sub-list for method output_type+ 7, // [7:9] is the sub-list for method input_type+ 7, // [7:7] is the sub-list for extension type_name+ 7, // [7:7] is the sub-list for extension extendee+ 0, // [0:7] is the sub-list for field type_name}func init() { file_v1_sql_service_proto_init() }@@ -743,7 +971,7 @@ func file_v1_sql_service_proto_init() {}}file_v1_sql_service_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} {- switch v := v.(*Advice); i {+ switch v := v.(*RowValue); i {case 0:return &v.statecase 1:@@ -755,7 +983,7 @@ func file_v1_sql_service_proto_init() {}}file_v1_sql_service_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} {- switch v := v.(*PrettyRequest); i {+ switch v := v.(*Advice); i {case 0:return &v.statecase 1:@@ -767,6 +995,18 @@ func file_v1_sql_service_proto_init() {}}file_v1_sql_service_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} {+ switch v := v.(*PrettyRequest); i {+ case 0:+ return &v.state+ case 1:+ return &v.sizeCache+ case 2:+ return &v.unknownFields+ default:+ return nil+ }+ }+ file_v1_sql_service_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} {switch v := v.(*PrettyResponse); i {case 0:return &v.state@@ -779,13 +1019,25 @@ func file_v1_sql_service_proto_init() {}}}+ file_v1_sql_service_proto_msgTypes[4].OneofWrappers = []interface{}{+ (*RowValue_NullValue)(nil),+ (*RowValue_BoolValue)(nil),+ (*RowValue_BytesValue)(nil),+ (*RowValue_DoubleValue)(nil),+ (*RowValue_FloatValue)(nil),+ (*RowValue_Int32Value)(nil),+ (*RowValue_Int64Value)(nil),+ (*RowValue_StringValue)(nil),+ (*RowValue_Uint32Value)(nil),+ (*RowValue_Uint64Value)(nil),+ }type x struct{}out := protoimpl.TypeBuilder{File: protoimpl.DescBuilder{GoPackagePath: reflect.TypeOf(x{}).PkgPath(),RawDescriptor: file_v1_sql_service_proto_rawDesc,NumEnums: 1,- NumMessages: 7,+ NumMessages: 8,NumExtensions: 0,NumServices: 1,},diff --git a/proto/v1/sql_service.proto b/proto/v1/sql_service.protoindex 7f16631f11..e70f92154f 100644--- a/proto/v1/sql_service.proto+++ b/proto/v1/sql_service.proto@@ -4,6 +4,7 @@ package bytebase.v1;import "google/api/annotations.proto";import "google/api/field_behavior.proto";+import "google/protobuf/struct.proto";import "v1/common.proto";option go_package = "generated-go/v1";@@ -53,6 +54,7 @@ message QueryResult {repeated string column_names = 1;// Column types of the query result.+ // The types come from the Golang SQL driver.repeated string column_type_names = 2;// Rows of the query result.@@ -67,7 +69,22 @@ message QueryResult {message QueryRow {// Row values of the query result.- repeated string values = 1;+ repeated RowValue values = 1;+}++message RowValue {+ oneof kind {+ google.protobuf.NullValue null_value = 1;+ bool bool_value = 2;+ bytes bytes_value = 3;+ double double_value = 4;+ float float_value = 5;+ int32 int32_value = 6;+ int64 int64_value = 7;+ string string_value = 8;+ uint32 uint32_value = 9;+ uint64 uint64_value = 10;+ }}message Advice {