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: query history store (#11352)
ecmadao84fcb3ec3aee
diff --git a/backend/api/v1/acl_iam.go b/backend/api/v1/acl_iam.goindex 7679263157..2597fe11d0 100644--- a/backend/api/v1/acl_iam.go+++ b/backend/api/v1/acl_iam.go@@ -70,7 +70,7 @@ func isSkippedMethod(fullMethod string) bool {v1pb.LoggingService_GetLog_FullMethodName,v1pb.LoggingService_ExportLogs_FullMethodName,v1pb.SQLService_Query_FullMethodName,- v1pb.SQLService_ListQueryHistories_FullMethodName,+ v1pb.SQLService_SearchQueryHistories_FullMethodName,v1pb.SQLService_Export_FullMethodName,v1pb.SQLService_DifferPreview_FullMethodName,v1pb.SQLService_Check_FullMethodName,diff --git a/backend/api/v1/sql_service.go b/backend/api/v1/sql_service.goindex d67b9b6106..c66c87b200 100644--- a/backend/api/v1/sql_service.go+++ b/backend/api/v1/sql_service.go@@ -174,7 +174,7 @@ func (s *SQLService) AdminExecute(server v1pb.SQLService_AdminExecuteServer) errresult, durationNs, queryErr := s.doAdminExecute(ctx, driver, conn, request)sanitizeResults(result)- if err := s.postAdminExecute(ctx, activity, durationNs, queryErr); err != nil {+ if err := s.postQuery(ctx, database, activity, durationNs, queryErr); err != nil {slog.Error("failed to post admin execute activity", log.BBError(err))}@@ -203,43 +203,6 @@ func (s *SQLService) AdminExecute(server v1pb.SQLService_AdminExecuteServer) err}}-func (s *SQLService) postAdminExecute(ctx context.Context, activity *store.ActivityMessage, durationNs int64, queryErr error) error {- var payload api.ActivitySQLEditorQueryPayload- if err := json.Unmarshal([]byte(activity.Payload), &payload); err != nil {- return status.Errorf(codes.Internal, "failed to unmarshal activity payload: %v", err)- }-- var newLevel *api.ActivityLevel- payload.DurationNs = durationNs- if queryErr != nil {- payload.Error = queryErr.Error()- errorLevel := api.ActivityError- newLevel = &errorLevel- }-- // TODO: update the advice list- payloadBytes, err := json.Marshal(payload)- if err != nil {- slog.Warn("Failed to marshal activity after executing sql statement",- slog.String("database_name", payload.DatabaseName),- slog.Int("instance_id", payload.InstanceID),- slog.String("statement", payload.Statement),- log.BBError(err))- return status.Errorf(codes.Internal, "Failed to marshal activity after executing sql statement: %v", err)- }-- payloadString := string(payloadBytes)- if _, err := s.store.UpdateActivityV2(ctx, &store.UpdateActivityMessage{- UID: activity.UID,- Level: newLevel,- Payload: &payloadString,- }); err != nil {- return status.Errorf(codes.Internal, "Failed to update activity after executing sql statement: %v", err)- }-- return nil-}-func (*SQLService) doAdminExecute(ctx context.Context, driver db.Driver, conn *sql.Conn, request *v1pb.AdminExecuteRequest) ([]*v1pb.QueryResult, int64, error) {start := time.Now().UnixNano()timeout := defaultTimeout@@ -353,7 +316,7 @@ func (s *SQLService) Export(ctx context.Context, request *v1pb.ExportRequest) (*bytes, durationNs, exportErr := DoExport(ctx, s.store, s.dbFactory, s.licenseService, request, instance, database, spans)- if err := s.postExport(ctx, activity, durationNs, exportErr); err != nil {+ if err := s.postExport(ctx, database, activity, durationNs, exportErr); err != nil {return nil, err}@@ -445,7 +408,7 @@ func DoExport(ctx context.Context, storeInstance *store.Store, dbFactory *dbfactreturn content, durationNs, nil}-func (s *SQLService) postExport(ctx context.Context, activity *store.ActivityMessage, durationNs int64, queryErr error) error {+func (s *SQLService) postExport(ctx context.Context, database *store.DatabaseMessage, activity *store.ActivityMessage, durationNs int64, queryErr error) error {// Update the activityvar payload api.ActivitySQLExportPayloadif err := json.Unmarshal([]byte(activity.Payload), &payload); err != nil {@@ -481,6 +444,20 @@ func (s *SQLService) postExport(ctx context.Context, activity *store.ActivityMesreturn status.Errorf(codes.Internal, "Failed to update activity after exporting sql statement: %v", err)}+ if _, err := s.store.CreateQueryHistory(ctx, &store.QueryHistoryMessage{+ CreatorUID: activity.CreatorUID,+ ProjectID: database.ProjectID,+ Database: common.FormatDatabase(database.InstanceID, database.DatabaseName),+ Statement: payload.Statement,+ Type: store.QueryHistoryTypeExport,+ Payload: &storepb.QueryHistoryPayload{+ Error: &payload.Error,+ Duration: durationpb.New(time.Duration(durationNs)),+ },+ }); err != nil {+ return status.Errorf(codes.Internal, "Failed to create export history with error: %v", err)+ }+return nil}@@ -902,7 +879,7 @@ func convertValueToStringInXLSX(value *v1pb.RowValue) string {}}-func (s *SQLService) createExportActivity(ctx context.Context, user *store.UserMessage, level api.ActivityLevel, containerID int, database *store.DatabaseMessage, payload api.ActivitySQLExportPayload) (*store.ActivityMessage, error) {+func (s *SQLService) createExportActivity(ctx context.Context, user *store.UserMessage, level api.ActivityLevel, instanceUID int, database *store.DatabaseMessage, payload api.ActivitySQLExportPayload) (*store.ActivityMessage, error) {// TODO: use v1 activity API instead ofactivityBytes, err := json.Marshal(payload)if err != nil {@@ -918,7 +895,7 @@ func (s *SQLService) createExportActivity(ctx context.Context, user *store.UserMCreatorUID: user.ID,Type: api.ActivitySQLExport,ResourceContainer: fmt.Sprintf("projects/%s", database.ProjectID),- ContainerUID: containerID,+ ContainerUID: instanceUID,Level: level,Comment: fmt.Sprintf("Export `%q` in database %q of instance %d.",payload.Statement, payload.DatabaseName, payload.InstanceID),@@ -932,8 +909,8 @@ func (s *SQLService) createExportActivity(ctx context.Context, user *store.UserMreturn activity, nil}-// ListQueryHistories lists query histories.-func (s *SQLService) ListQueryHistories(ctx context.Context, request *v1pb.ListQueryHistoriesRequest) (*v1pb.ListQueryHistoriesResponse, error) {+// SearchQueryHistories lists query histories.+func (s *SQLService) SearchQueryHistories(ctx context.Context, request *v1pb.SearchQueryHistoriesRequest) (*v1pb.SearchQueryHistoriesResponse, error) {var pageToken storepb.PageTokenif request.PageToken != "" {if err := unmarshalPageToken(request.PageToken, &pageToken); err != nil {@@ -958,20 +935,10 @@ func (s *SQLService) ListQueryHistories(ctx context.Context, request *v1pb.ListQreturn nil, status.Errorf(codes.Internal, "principal ID not found")}- order := api.DESC- activityFind := &store.FindActivityMessage{- Order: &order,- TypeList: []api.ActivityType{- api.ActivitySQLQuery,- },+ find := &store.FindQueryHistoryMessage{CreatorUID: &principalID,- LevelList: []api.ActivityLevel{- api.ActivityInfo,- api.ActivityWarn,- api.ActivityError,- },- Limit: &limitPlusOne,- Offset: &offset,+ Limit: &limitPlusOne,+ Offset: &offset,}filters, err := parseFilter(request.Filter)@@ -979,40 +946,33 @@ func (s *SQLService) ListQueryHistories(ctx context.Context, request *v1pb.ListQreturn nil, status.Errorf(codes.InvalidArgument, err.Error())}- var instanceName string- var databaseName stringfor _, spec := range filters {+ if spec.operator != comparatorTypeEqual {+ return nil, status.Errorf(codes.InvalidArgument, `only support "=" operation for "%v" filter`, spec.key)+ }switch spec.key {case "database":- instanceID, _, err := common.GetInstanceDatabaseID(spec.value)- if err != nil {- return nil, status.Errorf(codes.InvalidArgument, err.Error())- }- databaseName = spec.value- instanceName = fmt.Sprintf("%s%s", common.InstanceNamePrefix, instanceID)+ database := spec.value+ find.Database = &databasecase "instance":- instanceName = spec.value+ instance := spec.value+ find.Instance = &instance+ case "type":+ historyType := store.QueryHistoryType(spec.value)+ find.Type = &historyTypedefault:return nil, status.Errorf(codes.InvalidArgument, "invalid filter %s", spec.key)}}- if instanceName != "" {- instance, err := getInstanceMessage(ctx, s.store, instanceName)- if err != nil {- return nil, err- }- activityFind.ContainerUID = &instance.UID- }-- activityList, err := s.store.ListActivityV2(ctx, activityFind)+ historyList, err := s.store.ListQueryHistories(ctx, find)if err != nil {- return nil, status.Errorf(codes.Internal, "failed to list activity: %v", err.Error())+ return nil, status.Errorf(codes.Internal, "failed to list history: %v", err.Error())}nextPageToken := ""- if len(activityList) == limitPlusOne {- activityList = activityList[:limit]+ if len(historyList) == limitPlusOne {+ historyList = historyList[:limit]if nextPageToken, err = marshalPageToken(&storepb.PageToken{Limit: int32(limit),Offset: int32(limit + offset),@@ -1021,16 +981,15 @@ func (s *SQLService) ListQueryHistories(ctx context.Context, request *v1pb.ListQ}}- resp := &v1pb.ListQueryHistoriesResponse{+ resp := &v1pb.SearchQueryHistoriesResponse{NextPageToken: nextPageToken,}- for _, activity := range activityList {- queryHistory, err := s.convertToQueryHistory(ctx, activity)+ for _, history := range historyList {+ queryHistory, err := s.convertToV1QueryHistory(ctx, history)if err != nil {return nil, status.Errorf(codes.Internal, "failed to convert log entity, error: %v", err)}- // TODO: set database in activity query.- if databaseName != "" && queryHistory.Database != databaseName {+ if queryHistory == nil {continue}resp.QueryHistories = append(resp.QueryHistories, queryHistory)@@ -1039,38 +998,32 @@ func (s *SQLService) ListQueryHistories(ctx context.Context, request *v1pb.ListQreturn resp, nil}-func (s *SQLService) convertToQueryHistory(ctx context.Context, activity *store.ActivityMessage) (*v1pb.QueryHistory, error) {- var payload api.ActivitySQLEditorQueryPayload- if err := json.Unmarshal([]byte(activity.Payload), &payload); err != nil {- return nil, status.Errorf(codes.Internal, "failed to unmarshal payload for activity %v: %v", activity.UID, err.Error())- }-- database, err := s.store.GetDatabaseV2(ctx, &store.FindDatabaseMessage{- UID: &payload.DatabaseID,- })- if err != nil {- return nil, status.Errorf(codes.Internal, err.Error())- }- if database == nil {- return nil, status.Errorf(codes.NotFound, "database %q not found", payload.DatabaseID)- }-- user, err := s.store.GetUserByID(ctx, activity.CreatorUID)+func (s *SQLService) convertToV1QueryHistory(ctx context.Context, history *store.QueryHistoryMessage) (*v1pb.QueryHistory, error) {+ user, err := s.store.GetUserByID(ctx, history.CreatorUID)if err != nil {return nil, err}if user == nil {- return nil, errors.Errorf("cannot found user with id %d", activity.ContainerUID)+ return nil, errors.Errorf("cannot found user with id %d", history.CreatorUID)+ }++ historyType := v1pb.QueryHistory_TYPE_UNSPECIFIED+ switch history.Type {+ case store.QueryHistoryTypeExport:+ historyType = v1pb.QueryHistory_EXPORT+ case store.QueryHistoryTypeQuery:+ historyType = v1pb.QueryHistory_QUERY}return &v1pb.QueryHistory{- Name: fmt.Sprintf("queryHistories/%d", activity.UID),- Statement: payload.Statement,- Error: &payload.Error,- Database: common.FormatDatabase(database.InstanceID, database.DatabaseName),+ Name: fmt.Sprintf("queryHistories/%d", history.UID),+ Statement: history.Statement,+ Error: history.Payload.Error,+ Database: history.Database,Creator: fmt.Sprintf("%s%s", common.UserNamePrefix, user.Email),- CreateTime: timestamppb.New(time.Unix(activity.CreatedTs, 0)),- Duration: durationpb.New(time.Duration(payload.DurationNs)),+ CreateTime: timestamppb.New(history.CreatedTime),+ Duration: history.Payload.Duration,+ Type: historyType,}, nil}@@ -1175,7 +1128,7 @@ func (s *SQLService) Query(ctx context.Context, request *v1pb.QueryRequest) (*v1}// Update activity.- if err = s.postQuery(ctx, activity, durationNs, queryErr); err != nil {+ if err = s.postQuery(ctx, database, activity, durationNs, queryErr); err != nil {return nil, err}if queryErr != nil {@@ -1255,7 +1208,7 @@ func (s *SQLService) doQuery(ctx context.Context, request *v1pb.QueryRequest, in// postQuery does the following:// 1. Check index hit Explain statements// 2. Update SQL query activity-func (s *SQLService) postQuery(ctx context.Context, activity *store.ActivityMessage, durationNs int64, queryErr error) error {+func (s *SQLService) postQuery(ctx context.Context, database *store.DatabaseMessage, activity *store.ActivityMessage, durationNs int64, queryErr error) error {newLevel := activity.Level// Update the activity@@ -1289,6 +1242,20 @@ func (s *SQLService) postQuery(ctx context.Context, activity *store.ActivityMessreturn status.Errorf(codes.Internal, "Failed to update activity after executing sql statement: %v", err)}+ if _, err := s.store.CreateQueryHistory(ctx, &store.QueryHistoryMessage{+ CreatorUID: activity.CreatorUID,+ ProjectID: database.ProjectID,+ Database: common.FormatDatabase(database.InstanceID, database.DatabaseName),+ Statement: payload.Statement,+ Type: store.QueryHistoryTypeQuery,+ Payload: &storepb.QueryHistoryPayload{+ Error: &payload.Error,+ Duration: durationpb.New(time.Duration(durationNs)),+ },+ }); err != nil {+ return status.Errorf(codes.Internal, "Failed to create export history with error: %v", err)+ }+return nil}@@ -1465,7 +1432,7 @@ func sanitizeResults(results []*v1pb.QueryResult) {}}-func (s *SQLService) createQueryActivity(ctx context.Context, user *store.UserMessage, level api.ActivityLevel, containerID int, database *store.DatabaseMessage, payload api.ActivitySQLEditorQueryPayload) (*store.ActivityMessage, error) {+func (s *SQLService) createQueryActivity(ctx context.Context, user *store.UserMessage, level api.ActivityLevel, instanceUID int, database *store.DatabaseMessage, payload api.ActivitySQLEditorQueryPayload) (*store.ActivityMessage, error) {// TODO: use v1 activity API instead ofactivityBytes, err := json.Marshal(payload)if err != nil {@@ -1481,7 +1448,7 @@ func (s *SQLService) createQueryActivity(ctx context.Context, user *store.UserMeCreatorUID: user.ID,Type: api.ActivitySQLQuery,ResourceContainer: fmt.Sprintf("projects/%s", database.ProjectID),- ContainerUID: containerID,+ ContainerUID: instanceUID,Level: level,Comment: fmt.Sprintf("Executed `%q` in database %q of instance %d.",payload.Statement, payload.DatabaseName, payload.InstanceID),@@ -1492,6 +1459,7 @@ func (s *SQLService) createQueryActivity(ctx context.Context, user *store.UserMeif err != nil {return nil, status.Errorf(codes.Internal, "Failed to create activity: %v", err)}+return activity, nil}diff --git a/backend/migrator/migration/prod/2.15/0012##query_history.sql b/backend/migrator/migration/prod/2.15/0012##query_history.sqlnew file mode 100644index 0000000000..8c0eef0558--- /dev/null+++ b/backend/migrator/migration/prod/2.15/0012##query_history.sql@@ -0,0 +1,15 @@+CREATE TABLE query_history (+ id BIGSERIAL PRIMARY KEY,+ row_status row_status NOT NULL DEFAULT 'NORMAL',+ creator_id INTEGER NOT NULL REFERENCES principal (id),+ created_ts BIGINT NOT NULL DEFAULT extract(epoch from now()),+ project_id TEXT NOT NULL, -- the project resource id+ database TEXT NOT NULL, -- the database resource name, for example, instances/{instance}/databases/{database}+ statement TEXT NOT NULL,+ type TEXT NOT NULL, -- the history type, support QUERY and EXPORT.+ payload JSONB NOT NULL DEFAULT '{}' -- saved for details, like error, duration, etc.+);++CREATE INDEX idx_query_history_creator_id_created_ts_project_id ON query_history(creator_id, created_ts, project_id DESC);++ALTER SEQUENCE query_history_id_seq RESTART WITH 101;diff --git a/backend/migrator/migration/prod/LATEST.sql b/backend/migrator/migration/prod/LATEST.sqlindex 2e012c883f..a1ad840b40 100644--- a/backend/migrator/migration/prod/LATEST.sql+++ b/backend/migrator/migration/prod/LATEST.sql@@ -799,6 +799,22 @@ UPDATEON activity FOR EACH ROWEXECUTE FUNCTION trigger_update_updated_ts();+CREATE TABLE query_history (+ id BIGSERIAL PRIMARY KEY,+ row_status row_status NOT NULL DEFAULT 'NORMAL',+ creator_id INTEGER NOT NULL REFERENCES principal (id),+ created_ts BIGINT NOT NULL DEFAULT extract(epoch from now()),+ project_id TEXT NOT NULL, -- the project resource id+ database TEXT NOT NULL, -- the database resource name, for example, instances/{instance}/databases/{database}+ statement TEXT NOT NULL,+ type TEXT NOT NULL, -- the history type, support QUERY and EXPORT.+ payload JSONB NOT NULL DEFAULT '{}' -- saved for details, like error, duration, etc.+);++CREATE INDEX idx_query_history_creator_id_created_ts_project_id ON query_history(creator_id, created_ts, project_id DESC);++ALTER SEQUENCE query_history_id_seq RESTART WITH 101;+-- inbox table stores the inbox entry for the corresponding activity.-- Unlike other tables, it doesn't have row_status/creator_id/created_ts/updater_id/updated_ts.-- We design in this way because:diff --git a/backend/migrator/migrator_test.go b/backend/migrator/migrator_test.goindex 7d6794594c..8e05dca95e 100644--- a/backend/migrator/migrator_test.go+++ b/backend/migrator/migrator_test.go@@ -230,5 +230,5 @@ func TestMigrationCompatibility(t *testing.T) {func TestGetCutoffVersion(t *testing.T) {releaseVersion, err := getProdCutoffVersion()require.NoError(t, err)- require.Equal(t, semver.MustParse("2.15.11"), releaseVersion)+ require.Equal(t, semver.MustParse("2.15.12"), releaseVersion)}diff --git a/backend/store/query_history.go b/backend/store/query_history.gonew file mode 100644index 0000000000..f4be7447af--- /dev/null+++ b/backend/store/query_history.go@@ -0,0 +1,195 @@+package store++import (+ "context"+ "fmt"+ "strings"+ "time"++ "google.golang.org/protobuf/encoding/protojson"++ "github.com/pkg/errors"++ storepb "github.com/bytebase/bytebase/proto/generated-go/store"+)++type QueryHistoryType string++const (+ // QueryHistoryTypeQuery is the type for query.+ QueryHistoryTypeQuery QueryHistoryType = "QUERY"+ // QueryHistoryTypeExport is the type for export.+ QueryHistoryTypeExport QueryHistoryType = "EXPORT"+)++// QueryHistoryMessage is the API message for query history.+type QueryHistoryMessage struct {+ // Output only fields+ UID int+ CreatedTime time.Time++ // Related fields+ CreatorUID int+ // ProjectID is the project resource id.+ ProjectID string++ // Domain specific fields+ Type QueryHistoryType+ Statement string+ Payload *storepb.QueryHistoryPayload+ // Database is the database resource name, like instances/{instance}/databases/{database}+ Database string++ createdTs int64+}++// FindQueryHistoryMessage is the API message for finding query histories.+type FindQueryHistoryMessage struct {+ CreatorUID *int+ ProjectID *string+ // Instance is the instance resource name like instances/{instance}.+ Instance *string+ // Database is database resource name like instances/{instance}/databases/{database}.+ Database *string+ Type *QueryHistoryType++ Limit *int+ Offset *int+}++// CreateQueryHistory creates the query history.+func (s *Store) CreateQueryHistory(ctx context.Context, create *QueryHistoryMessage) (*QueryHistoryMessage, error) {+ payload, err := protojson.Marshal(create.Payload)+ if err != nil {+ return nil, err+ }++ tx, err := s.db.BeginTx(ctx, nil)+ if err != nil {+ return nil, err+ }+ defer tx.Rollback()++ if err := tx.QueryRowContext(ctx, `+ INSERT INTO query_history (+ creator_id,+ project_id,+ database,+ statement,+ type,+ payload+ )+ VALUES ($1, $2, $3, $4, $5, $6)+ RETURNING+ id,+ created_ts+ `,+ create.CreatorUID,+ create.ProjectID,+ create.Database,+ create.Statement,+ create.Type,+ payload,+ ).Scan(+ &create.UID,+ &create.createdTs,+ ); err != nil {+ return nil, err+ }+ if err := tx.Commit(); err != nil {+ return nil, errors.Wrapf(err, "failed to commit transaction")+ }++ create.CreatedTime = time.Unix(create.createdTs, 0)++ return create, nil+}++// ListQueryHistories lists the query history.+func (s *Store) ListQueryHistories(ctx context.Context, find *FindQueryHistoryMessage) ([]*QueryHistoryMessage, error) {+ where, args := []string{"TRUE"}, []any{}++ if v := find.CreatorUID; v != nil {+ where, args = append(where, fmt.Sprintf("query_history.creator_id = $%d", len(args)+1)), append(args, *v)+ }+ if v := find.ProjectID; v != nil {+ where, args = append(where, fmt.Sprintf("query_history.project_id = $%d", len(args)+1)), append(args, *v)+ }+ if v := find.Instance; v != nil {+ where, args = append(where, fmt.Sprintf("query_history.database LIKE $%d", len(args)+1)), append(args, *v)+ } else if v := find.Database; v != nil {+ where, args = append(where, fmt.Sprintf("query_history.database = $%d", len(args)+1)), append(args, *v)+ }+ if v := find.Type; v != nil {+ where, args = append(where, fmt.Sprintf("query_history.type = $%d", len(args)+1)), append(args, *v)+ }++ tx, err := s.db.BeginTx(ctx, nil)+ if err != nil {+ return nil, err+ }+ defer tx.Rollback()++ query := fmt.Sprintf(`+ SELECT+ query_history.id,+ query_history.creator_id,+ query_history.created_ts,+ query_history.project_id,+ query_history.database,+ query_history.statement,+ query_history.type,+ query_history.payload+ FROM query_history+ WHERE %s+ ORDER BY created_ts DESC+ `, strings.Join(where, " AND "))+ if v := find.Limit; v != nil {+ query += fmt.Sprintf(" LIMIT %d", *v)+ }+ if v := find.Offset; v != nil {+ query += fmt.Sprintf(" OFFSET %d", *v)+ }++ var queryHistories []*QueryHistoryMessage+ rows, err := tx.QueryContext(ctx, query, args...)+ if err != nil {+ return nil, err+ }+ defer rows.Close()++ for rows.Next() {+ queryHistory := &QueryHistoryMessage{}+ var payloadStr string+ if err := rows.Scan(+ &queryHistory.UID,+ &queryHistory.CreatorUID,+ &queryHistory.createdTs,+ &queryHistory.ProjectID,+ &queryHistory.Database,+ &queryHistory.Statement,+ &queryHistory.Type,+ &payloadStr,+ ); err != nil {+ return nil, err+ }++ var payload storepb.QueryHistoryPayload+ if err := protojson.Unmarshal([]byte(payloadStr), &payload); err != nil {+ return nil, err+ }+ queryHistory.Payload = &payload+ queryHistory.CreatedTime = time.Unix(queryHistory.createdTs, 0)++ queryHistories = append(queryHistories, queryHistory)+ }+ if err := rows.Err(); err != nil {+ return nil, err+ }++ if err := tx.Commit(); err != nil {+ return nil, err+ }++ return queryHistories, nil+}diff --git a/frontend/src/store/modules/sqlEditor/queryHistory.ts b/frontend/src/store/modules/sqlEditor/queryHistory.tsindex 4a0e9cda66..323c511607 100644--- a/frontend/src/store/modules/sqlEditor/queryHistory.ts+++ b/frontend/src/store/modules/sqlEditor/queryHistory.ts@@ -11,8 +11,9 @@ export const useSQLEditorQueryHistoryStore = defineStore(const fetchQueryHistoryList = async () => {isFetching.value = true;- const resp = await sqlServiceClient.listQueryHistories({+ const resp = await sqlServiceClient.searchQueryHistories({pageSize: 20,+ filter: `type = "QUERY"`,});queryHistoryList.value = resp.queryHistories;isFetching.value = false;diff --git a/frontend/src/types/proto/store/query_history.ts b/frontend/src/types/proto/store/query_history.tsnew file mode 100644index 0000000000..738e943037--- /dev/null+++ b/frontend/src/types/proto/store/query_history.ts@@ -0,0 +1,104 @@+/* eslint-disable */+import Long from "long";+import _m0 from "protobufjs/minimal";+import { Duration } from "../google/protobuf/duration";++export const protobufPackage = "bytebase.store";++export interface QueryHistoryPayload {+ error?: string | undefined;+ duration: Duration | undefined;+}++function createBaseQueryHistoryPayload(): QueryHistoryPayload {+ return { error: undefined, duration: undefined };+}++export const QueryHistoryPayload = {+ encode(message: QueryHistoryPayload, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {+ if (message.error !== undefined) {+ writer.uint32(10).string(message.error);+ }+ if (message.duration !== undefined) {+ Duration.encode(message.duration, writer.uint32(18).fork()).ldelim();+ }+ return writer;+ },++ decode(input: _m0.Reader | Uint8Array, length?: number): QueryHistoryPayload {+ const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);+ let end = length === undefined ? reader.len : reader.pos + length;+ const message = createBaseQueryHistoryPayload();+ while (reader.pos < end) {+ const tag = reader.uint32();+ switch (tag >>> 3) {+ case 1:+ if (tag !== 10) {+ break;+ }++ message.error = reader.string();+ continue;+ case 2:+ if (tag !== 18) {+ break;+ }++ message.duration = Duration.decode(reader, reader.uint32());+ continue;+ }+ if ((tag & 7) === 4 || tag === 0) {+ break;+ }+ reader.skipType(tag & 7);+ }+ return message;+ },++ fromJSON(object: any): QueryHistoryPayload {+ return {+ error: isSet(object.error) ? globalThis.String(object.error) : undefined,+ duration: isSet(object.duration) ? Duration.fromJSON(object.duration) : undefined,+ };+ },++ toJSON(message: QueryHistoryPayload): unknown {+ const obj: any = {};+ if (message.error !== undefined) {+ obj.error = message.error;+ }+ if (message.duration !== undefined) {+ obj.duration = Duration.toJSON(message.duration);+ }+ return obj;+ },++ create(base?: DeepPartial<QueryHistoryPayload>): QueryHistoryPayload {+ return QueryHistoryPayload.fromPartial(base ?? {});+ },+ fromPartial(object: DeepPartial<QueryHistoryPayload>): QueryHistoryPayload {+ const message = createBaseQueryHistoryPayload();+ message.error = object.error ?? undefined;+ message.duration = (object.duration !== undefined && object.duration !== null)+ ? Duration.fromPartial(object.duration)+ : undefined;+ return message;+ },+};++type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;++export type DeepPartial<T> = T extends Builtin ? T+ : T extends Long ? string | number | Long : T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>>+ : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>>+ : T extends {} ? { [K in keyof T]?: DeepPartial<T[K]> }+ : Partial<T>;++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/frontend/src/types/proto/v1/sql_service.ts b/frontend/src/types/proto/v1/sql_service.tsindex 05ce64c97a..df5a6b6fa3 100644--- a/frontend/src/types/proto/v1/sql_service.ts+++ b/frontend/src/types/proto/v1/sql_service.ts@@ -312,7 +312,7 @@ export interface StringifyMetadataResponse {schema: string;}-export interface ListQueryHistoriesRequest {+export interface SearchQueryHistoriesRequest {/*** Not used. The maximum number of histories to return.* The service may return fewer than this value.@@ -328,14 +328,18 @@ export interface ListQueryHistoriesRequest {/*** filter is the filter to apply on the search query history,* follow the [ebnf](https://en.wikipedia.org/wiki/Extended_Backus%E2%80%93Naur_form) syntax.- * Only support filter by database for now.- * For example:- * database = "instances/{instance}/databases/{database}"+ * Support filter by:+ * - database, for example:+ * database = "instances/{instance}/databases/{database}"+ * - instance, for example:+ * instance = "instance/{instance}"+ * - type, for example:+ * type = "QUERY"*/filter: string;}-export interface ListQueryHistoriesResponse {+export interface SearchQueryHistoriesResponse {/** The list of history. */queryHistories: QueryHistory[];/**@@ -362,6 +366,46 @@ export interface QueryHistory {statement: string;error?: string | undefined;duration: Duration | undefined;+ type: QueryHistory_Type;+}++export enum QueryHistory_Type {+ TYPE_UNSPECIFIED = 0,+ QUERY = 1,+ EXPORT = 2,+ UNRECOGNIZED = -1,+}++export function queryHistory_TypeFromJSON(object: any): QueryHistory_Type {+ switch (object) {+ case 0:+ case "TYPE_UNSPECIFIED":+ return QueryHistory_Type.TYPE_UNSPECIFIED;+ case 1:+ case "QUERY":+ return QueryHistory_Type.QUERY;+ case 2:+ case "EXPORT":+ return QueryHistory_Type.EXPORT;+ case -1:+ case "UNRECOGNIZED":+ default:+ return QueryHistory_Type.UNRECOGNIZED;+ }+}++export function queryHistory_TypeToJSON(object: QueryHistory_Type): string {+ switch (object) {+ case QueryHistory_Type.TYPE_UNSPECIFIED:+ return "TYPE_UNSPECIFIED";+ case QueryHistory_Type.QUERY:+ return "QUERY";+ case QueryHistory_Type.EXPORT:+ return "EXPORT";+ case QueryHistory_Type.UNRECOGNIZED:+ default:+ return "UNRECOGNIZED";+ }}function createBaseDifferPreviewRequest(): DifferPreviewRequest {@@ -2340,12 +2384,12 @@ export const StringifyMetadataResponse = {},};-function createBaseListQueryHistoriesRequest(): ListQueryHistoriesRequest {+function createBaseSearchQueryHistoriesRequest(): SearchQueryHistoriesRequest {return { pageSize: 0, pageToken: "", filter: "" };}-export const ListQueryHistoriesRequest = {- encode(message: ListQueryHistoriesRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {+export const SearchQueryHistoriesRequest = {+ encode(message: SearchQueryHistoriesRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {if (message.pageSize !== 0) {writer.uint32(8).int32(message.pageSize);}@@ -2358,10 +2402,10 @@ export const ListQueryHistoriesRequest = {return writer;},- decode(input: _m0.Reader | Uint8Array, length?: number): ListQueryHistoriesRequest {+ decode(input: _m0.Reader | Uint8Array, length?: number): SearchQueryHistoriesRequest {const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);let end = length === undefined ? reader.len : reader.pos + length;- const message = createBaseListQueryHistoriesRequest();+ const message = createBaseSearchQueryHistoriesRequest();while (reader.pos < end) {const tag = reader.uint32();switch (tag >>> 3) {@@ -2395,7 +2439,7 @@ export const ListQueryHistoriesRequest = {return message;},- fromJSON(object: any): ListQueryHistoriesRequest {+ fromJSON(object: any): SearchQueryHistoriesRequest {return {pageSize: isSet(object.pageSize) ? globalThis.Number(object.pageSize) : 0,pageToken: isSet(object.pageToken) ? globalThis.String(object.pageToken) : "",@@ -2403,7 +2447,7 @@ export const ListQueryHistoriesRequest = {};},- toJSON(message: ListQueryHistoriesRequest): unknown {+ toJSON(message: SearchQueryHistoriesRequest): unknown {const obj: any = {};if (message.pageSize !== 0) {obj.pageSize = Math.round(message.pageSize);@@ -2417,11 +2461,11 @@ export const ListQueryHistoriesRequest = {return obj;},- create(base?: DeepPartial<ListQueryHistoriesRequest>): ListQueryHistoriesRequest {- return ListQueryHistoriesRequest.fromPartial(base ?? {});+ create(base?: DeepPartial<SearchQueryHistoriesRequest>): SearchQueryHistoriesRequest {+ return SearchQueryHistoriesRequest.fromPartial(base ?? {});},- fromPartial(object: DeepPartial<ListQueryHistoriesRequest>): ListQueryHistoriesRequest {- const message = createBaseListQueryHistoriesRequest();+ fromPartial(object: DeepPartial<SearchQueryHistoriesRequest>): SearchQueryHistoriesRequest {+ const message = createBaseSearchQueryHistoriesRequest();message.pageSize = object.pageSize ?? 0;message.pageToken = object.pageToken ?? "";message.filter = object.filter ?? "";@@ -2429,12 +2473,12 @@ export const ListQueryHistoriesRequest = {},};-function createBaseListQueryHistoriesResponse(): ListQueryHistoriesResponse {+function createBaseSearchQueryHistoriesResponse(): SearchQueryHistoriesResponse {return { queryHistories: [], nextPageToken: "" };}-export const ListQueryHistoriesResponse = {- encode(message: ListQueryHistoriesResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {+export const SearchQueryHistoriesResponse = {+ encode(message: SearchQueryHistoriesResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {for (const v of message.queryHistories) {QueryHistory.encode(v!, writer.uint32(10).fork()).ldelim();}@@ -2444,10 +2488,10 @@ export const ListQueryHistoriesResponse = {return writer;},- decode(input: _m0.Reader | Uint8Array, length?: number): ListQueryHistoriesResponse {+ decode(input: _m0.Reader | Uint8Array, length?: number): SearchQueryHistoriesResponse {const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);let end = length === undefined ? reader.len : reader.pos + length;- const message = createBaseListQueryHistoriesResponse();+ const message = createBaseSearchQueryHistoriesResponse();while (reader.pos < end) {const tag = reader.uint32();switch (tag >>> 3) {@@ -2474,7 +2518,7 @@ export const ListQueryHistoriesResponse = {return message;},- fromJSON(object: any): ListQueryHistoriesResponse {+ fromJSON(object: any): SearchQueryHistoriesResponse {return {queryHistories: globalThis.Array.isArray(object?.queryHistories)? object.queryHistories.map((e: any) => QueryHistory.fromJSON(e))@@ -2483,7 +2527,7 @@ export const ListQueryHistoriesResponse = {};},- toJSON(message: ListQueryHistoriesResponse): unknown {+ toJSON(message: SearchQueryHistoriesResponse): unknown {const obj: any = {};if (message.queryHistories?.length) {obj.queryHistories = message.queryHistories.map((e) => QueryHistory.toJSON(e));@@ -2494,11 +2538,11 @@ export const ListQueryHistoriesResponse = {return obj;},- create(base?: DeepPartial<ListQueryHistoriesResponse>): ListQueryHistoriesResponse {- return ListQueryHistoriesResponse.fromPartial(base ?? {});+ create(base?: DeepPartial<SearchQueryHistoriesResponse>): SearchQueryHistoriesResponse {+ return SearchQueryHistoriesResponse.fromPartial(base ?? {});},- fromPartial(object: DeepPartial<ListQueryHistoriesResponse>): ListQueryHistoriesResponse {- const message = createBaseListQueryHistoriesResponse();+ fromPartial(object: DeepPartial<SearchQueryHistoriesResponse>): SearchQueryHistoriesResponse {+ const message = createBaseSearchQueryHistoriesResponse();message.queryHistories = object.queryHistories?.map((e) => QueryHistory.fromPartial(e)) || [];message.nextPageToken = object.nextPageToken ?? "";return message;@@ -2514,6 +2558,7 @@ function createBaseQueryHistory(): QueryHistory {statement: "",error: undefined,duration: undefined,+ type: 0,};}@@ -2540,6 +2585,9 @@ export const QueryHistory = {if (message.duration !== undefined) {Duration.encode(message.duration, writer.uint32(58).fork()).ldelim();}+ if (message.type !== 0) {+ writer.uint32(64).int32(message.type);+ }return writer;},@@ -2599,6 +2647,13 @@ export const QueryHistory = {message.duration = Duration.decode(reader, reader.uint32());continue;+ case 8:+ if (tag !== 64) {+ break;+ }++ message.type = reader.int32() as any;+ continue;}if ((tag & 7) === 4 || tag === 0) {break;@@ -2617,6 +2672,7 @@ export const QueryHistory = {statement: isSet(object.statement) ? globalThis.String(object.statement) : "",error: isSet(object.error) ? globalThis.String(object.error) : undefined,duration: isSet(object.duration) ? Duration.fromJSON(object.duration) : undefined,+ type: isSet(object.type) ? queryHistory_TypeFromJSON(object.type) : 0,};},@@ -2643,6 +2699,9 @@ export const QueryHistory = {if (message.duration !== undefined) {obj.duration = Duration.toJSON(message.duration);}+ if (message.type !== 0) {+ obj.type = queryHistory_TypeToJSON(message.type);+ }return obj;},@@ -2660,6 +2719,7 @@ export const QueryHistory = {message.duration = (object.duration !== undefined && object.duration !== null)? Duration.fromPartial(object.duration): undefined;+ message.type = object.type ?? 0;return message;},};@@ -2762,19 +2822,19 @@ export const SQLServiceDefinition = {},},},- listQueryHistories: {- name: "ListQueryHistories",- requestType: ListQueryHistoriesRequest,+ searchQueryHistories: {+ name: "SearchQueryHistories",+ requestType: SearchQueryHistoriesRequest,requestStream: false,- responseType: ListQueryHistoriesResponse,+ responseType: SearchQueryHistoriesResponse,responseStream: false,options: {_unknownFields: {578365826: [new Uint8Array([- 20,- 18,+ 27,18,+ 25,47,118,49,@@ -2793,6 +2853,13 @@ export const SQLServiceDefinition = {105,101,115,+ 58,+ 115,+ 101,+ 97,+ 114,+ 99,+ 104,]),],},diff --git a/proto/gen/grpc-doc/store/README.md b/proto/gen/grpc-doc/store/README.mdindex 92822b4952..f69756c980 100644--- a/proto/gen/grpc-doc/store/README.md+++ b/proto/gen/grpc-doc/store/README.md@@ -170,6 +170,9 @@- [ProtectionRule.BranchSource](#bytebase-store-ProtectionRule-BranchSource)- [ProtectionRule.Target](#bytebase-store-ProtectionRule-Target)+- [store/query_history.proto](#store_query_history-proto)+ - [QueryHistoryPayload](#bytebase-store-QueryHistoryPayload)+- [store/role.proto](#store_role-proto)- [RolePermissions](#bytebase-store-RolePermissions)@@ -2640,6 +2643,38 @@ The type of target.+<a name="store_query_history-proto"></a>+<p align="right"><a href="#top">Top</a></p>++## store/query_history.proto++++<a name="bytebase-store-QueryHistoryPayload"></a>++### QueryHistoryPayload++++| Field | Type | Label | Description |+| ----- | ---- | ----- | ----------- |+| error | [string](#string) | optional | |+| duration | [google.protobuf.Duration](#google-protobuf-Duration) | | |+++++++++++++++<a name="store_role-proto"></a><p align="right"><a href="#top">Top</a></p>diff --git a/proto/gen/grpc-doc/store/index.html b/proto/gen/grpc-doc/store/index.htmlindex b20bcc33ef..d9b9baa5a7 100644--- a/proto/gen/grpc-doc/store/index.html+++ b/proto/gen/grpc-doc/store/index.html@@ -853,6 +853,21 @@</li>+ <li>+ <a href="#store%2fquery_history.proto">store/query_history.proto</a>+ <ul>++ <li>+ <a href="#bytebase.store.QueryHistoryPayload"><span class="badge">M</span>QueryHistoryPayload</a>+ </li>+++++ </ul>+ </li>++<li><a href="#store%2frole.proto">store/role.proto</a><ul>@@ -6711,6 +6726,51 @@ Format: roles/projectOwner. </p></td>+ <div class="file-heading">+ <h2 id="store/query_history.proto">store/query_history.proto</h2><a href="#title">Top</a>+ </div>+ <p></p>+++ <h3 id="bytebase.store.QueryHistoryPayload">QueryHistoryPayload</h3>+ <p></p>+++ <table class="field-table">+ <thead>+ <tr><td>Field</td><td>Type</td><td>Label</td><td>Description</td></tr>+ </thead>+ <tbody>++ <tr>+ <td>error</td>+ <td><a href="#string">string</a></td>+ <td>optional</td>+ <td><p> </p></td>+ </tr>++ <tr>+ <td>duration</td>+ <td><a href="#google.protobuf.Duration">google.protobuf.Duration</a></td>+ <td></td>+ <td><p> </p></td>+ </tr>++ </tbody>+ </table>+++++++++++++<div class="file-heading"><h2 id="store/role.proto">store/role.proto</h2><a href="#title">Top</a></div>diff --git a/proto/gen/grpc-doc/v1/README.md b/proto/gen/grpc-doc/v1/README.mdindex 93e53e9c10..8fde73bf9d 100644--- a/proto/gen/grpc-doc/v1/README.md+++ b/proto/gen/grpc-doc/v1/README.md@@ -582,8 +582,6 @@- [DifferPreviewResponse](#bytebase-v1-DifferPreviewResponse)- [ExportRequest](#bytebase-v1-ExportRequest)- [ExportResponse](#bytebase-v1-ExportResponse)- - [ListQueryHistoriesRequest](#bytebase-v1-ListQueryHistoriesRequest)- - [ListQueryHistoriesResponse](#bytebase-v1-ListQueryHistoriesResponse)- [ParseMyBatisMapperRequest](#bytebase-v1-ParseMyBatisMapperRequest)- [ParseMyBatisMapperResponse](#bytebase-v1-ParseMyBatisMapperResponse)- [PrettyRequest](#bytebase-v1-PrettyRequest)@@ -594,11 +592,14 @@- [QueryResult](#bytebase-v1-QueryResult)- [QueryRow](#bytebase-v1-QueryRow)- [RowValue](#bytebase-v1-RowValue)+ - [SearchQueryHistoriesRequest](#bytebase-v1-SearchQueryHistoriesRequest)+ - [SearchQueryHistoriesResponse](#bytebase-v1-SearchQueryHistoriesResponse)- [StringifyMetadataRequest](#bytebase-v1-StringifyMetadataRequest)- [StringifyMetadataResponse](#bytebase-v1-StringifyMetadataResponse)- [Advice.Status](#bytebase-v1-Advice-Status)- [CheckRequest.ChangeType](#bytebase-v1-CheckRequest-ChangeType)+ - [QueryHistory.Type](#bytebase-v1-QueryHistory-Type)- [SQLService](#bytebase-v1-SQLService)@@ -9385,39 +9386,6 @@ Type of the SheetPayload.-<a name="bytebase-v1-ListQueryHistoriesRequest"></a>--### ListQueryHistoriesRequest----| Field | Type | Label | Description |-| ----- | ---- | ----- | ----------- |-| page_size | [int32](#int32) | | Not used. The maximum number of histories to return. The service may return fewer than this value. If unspecified, at most 100 history entries will be returned. The maximum value is 1000; values above 1000 will be coerced to 1000. |-| page_token | [string](#string) | | Not used. A page token, received from a previous `ListQueryHistory` call. Provide this to retrieve the subsequent page. |-| filter | [string](#string) | | filter is the filter to apply on the search query history, follow the [ebnf](https://en.wikipedia.org/wiki/Extended_Backus%E2%80%93Naur_form) syntax. Only support filter by database for now. For example: database = "instances/{instance}/databases/{database}" |-------<a name="bytebase-v1-ListQueryHistoriesResponse"></a>--### ListQueryHistoriesResponse----| Field | Type | Label | Description |-| ----- | ---- | ----- | ----------- |-| query_histories | [QueryHistory](#bytebase-v1-QueryHistory) | repeated | The list of history. |-| next_page_token | [string](#string) | | A token to retrieve next page of history. Pass this value in the page_token field in the subsequent call to `ListQueryHistory` method to retrieve the next page of history. |------<a name="bytebase-v1-ParseMyBatisMapperRequest"></a>### ParseMyBatisMapperRequest@@ -9496,6 +9464,7 @@ Type of the SheetPayload.| statement | [string](#string) | | || error | [string](#string) | optional | || duration | [google.protobuf.Duration](#google-protobuf-Duration) | | |+| type | [QueryHistory.Type](#bytebase-v1-QueryHistory-Type) | | |@@ -9601,6 +9570,39 @@ Type of the SheetPayload.+<a name="bytebase-v1-SearchQueryHistoriesRequest"></a>++### SearchQueryHistoriesRequest++++| Field | Type | Label | Description |+| ----- | ---- | ----- | ----------- |+| page_size | [int32](#int32) | | Not used. The maximum number of histories to return. The service may return fewer than this value. If unspecified, at most 100 history entries will be returned. The maximum value is 1000; values above 1000 will be coerced to 1000. |+| page_token | [string](#string) | | Not used. A page token, received from a previous `ListQueryHistory` call. Provide this to retrieve the subsequent page. |+| filter | [string](#string) | | filter is the filter to apply on the search query history, follow the [ebnf](https://en.wikipedia.org/wiki/Extended_Backus%E2%80%93Naur_form) syntax. Support filter by: - database, for example: database = "instances/{instance}/databases/{database}" - instance, for example: instance = "instance/{instance}" - type, for example: type = "QUERY" |+++++++<a name="bytebase-v1-SearchQueryHistoriesResponse"></a>++### SearchQueryHistoriesResponse++++| Field | Type | Label | Description |+| ----- | ---- | ----- | ----------- |+| query_histories | [QueryHistory](#bytebase-v1-QueryHistory) | repeated | The list of history. |+| next_page_token | [string](#string) | | A token to retrieve next page of history. Pass this value in the page_token field in the subsequent call to `ListQueryHistory` method to retrieve the next page of history. |++++++<a name="bytebase-v1-StringifyMetadataRequest"></a>### StringifyMetadataRequest@@ -9661,6 +9663,19 @@ Type of the SheetPayload.| DML | 3 | |++<a name="bytebase-v1-QueryHistory-Type"></a>++### QueryHistory.Type+++| Name | Number | Description |+| ---- | ------ | ----------- |+| TYPE_UNSPECIFIED | 0 | |+| QUERY | 1 | |+| EXPORT | 2 | |++@@ -9674,7 +9689,7 @@ Type of the SheetPayload.| Method Name | Request Type | Response Type | Description || ----------- | ------------ | ------------- | ------------|| Query | [QueryRequest](#bytebase-v1-QueryRequest) | [QueryResponse](#bytebase-v1-QueryResponse) | |-| ListQueryHistories | [ListQueryHistoriesRequest](#bytebase-v1-ListQueryHistoriesRequest) | [ListQueryHistoriesResponse](#bytebase-v1-ListQueryHistoriesResponse) | |+| SearchQueryHistories | [SearchQueryHistoriesRequest](#bytebase-v1-SearchQueryHistoriesRequest) | [SearchQueryHistoriesResponse](#bytebase-v1-SearchQueryHistoriesResponse) | || Export | [ExportRequest](#bytebase-v1-ExportRequest) | [ExportResponse](#bytebase-v1-ExportResponse) | || AdminExecute | [AdminExecuteRequest](#bytebase-v1-AdminExecuteRequest) stream | [AdminExecuteResponse](#bytebase-v1-AdminExecuteResponse) stream | || DifferPreview | [DifferPreviewRequest](#bytebase-v1-DifferPreviewRequest) | [DifferPreviewResponse](#bytebase-v1-DifferPreviewResponse) | |diff --git a/proto/gen/grpc-doc/v1/index.html b/proto/gen/grpc-doc/v1/index.htmlindex 3952c4944b..b09ce60598 100644--- a/proto/gen/grpc-doc/v1/index.html+++ b/proto/gen/grpc-doc/v1/index.html@@ -2405,14 +2405,6 @@<a href="#bytebase.v1.ExportResponse"><span class="badge">M</span>ExportResponse</a></li>- <li>- <a href="#bytebase.v1.ListQueryHistoriesRequest"><span class="badge">M</span>ListQueryHistoriesRequest</a>- </li>-- <li>- <a href="#bytebase.v1.ListQueryHistoriesResponse"><span class="badge">M</span>ListQueryHistoriesResponse</a>- </li>-<li><a href="#bytebase.v1.ParseMyBatisMapperRequest"><span class="badge">M</span>ParseMyBatisMapperRequest</a></li>@@ -2453,6 +2445,14 @@<a href="#bytebase.v1.RowValue"><span class="badge">M</span>RowValue</a></li>+ <li>+ <a href="#bytebase.v1.SearchQueryHistoriesRequest"><span class="badge">M</span>SearchQueryHistoriesRequest</a>+ </li>++ <li>+ <a href="#bytebase.v1.SearchQueryHistoriesResponse"><span class="badge">M</span>SearchQueryHistoriesResponse</a>+ </li>+<li><a href="#bytebase.v1.StringifyMetadataRequest"><span class="badge">M</span>StringifyMetadataRequest</a></li>@@ -2470,6 +2470,10 @@<a href="#bytebase.v1.CheckRequest.ChangeType"><span class="badge">E</span>CheckRequest.ChangeType</a></li>+ <li>+ <a href="#bytebase.v1.QueryHistory.Type"><span class="badge">E</span>QueryHistory.Type</a>+ </li>+<li>@@ -25836,85 +25840,6 @@ The exported data is not masked. </p></td>- <h3 id="bytebase.v1.ListQueryHistoriesRequest">ListQueryHistoriesRequest</h3>- <p></p>--- <table class="field-table">- <thead>- <tr><td>Field</td><td>Type</td><td>Label</td><td>Description</td></tr>- </thead>- <tbody>-- <tr>- <td>page_size</td>- <td><a href="#int32">int32</a></td>- <td></td>- <td><p>Not used. The maximum number of histories to return.-The service may return fewer than this value.-If unspecified, at most 100 history entries will be returned.-The maximum value is 1000; values above 1000 will be coerced to 1000. </p></td>- </tr>-- <tr>- <td>page_token</td>- <td><a href="#string">string</a></td>- <td></td>- <td><p>Not used. A page token, received from a previous `ListQueryHistory` call.-Provide this to retrieve the subsequent page. </p></td>- </tr>-- <tr>- <td>filter</td>- <td><a href="#string">string</a></td>- <td></td>- <td><p>filter is the filter to apply on the search query history,-follow the [ebnf](https://en.wikipedia.org/wiki/Extended_Backus%E2%80%93Naur_form) syntax.-Only support filter by database for now.-For example:-database = "instances/{instance}/databases/{database}" </p></td>- </tr>-- </tbody>- </table>------ <h3 id="bytebase.v1.ListQueryHistoriesResponse">ListQueryHistoriesResponse</h3>- <p></p>--- <table class="field-table">- <thead>- <tr><td>Field</td><td>Type</td><td>Label</td><td>Description</td></tr>- </thead>- <tbody>-- <tr>- <td>query_histories</td>- <td><a href="#bytebase.v1.QueryHistory">QueryHistory</a></td>- <td>repeated</td>- <td><p>The list of history. </p></td>- </tr>-- <tr>- <td>next_page_token</td>- <td><a href="#string">string</a></td>- <td></td>- <td><p>A token to retrieve next page of history.-Pass this value in the page_token field in the subsequent call to `ListQueryHistory` method-to retrieve the next page of history. </p></td>- </tr>-- </tbody>- </table>-----<h3 id="bytebase.v1.ParseMyBatisMapperRequest">ParseMyBatisMapperRequest</h3><p></p>@@ -26094,6 +26019,13 @@ Format: instances/{instance}/databases/{databaseName} </p></td><td><p> </p></td></tr>+ <tr>+ <td>type</td>+ <td><a href="#bytebase.v1.QueryHistory.Type">QueryHistory.Type</a></td>+ <td></td>+ <td><p> </p></td>+ </tr>+</tbody></table>@@ -26414,6 +26346,89 @@ The types come from the Golang SQL driver. </p></td>+ <h3 id="bytebase.v1.SearchQueryHistoriesRequest">SearchQueryHistoriesRequest</h3>+ <p></p>+++ <table class="field-table">+ <thead>+ <tr><td>Field</td><td>Type</td><td>Label</td><td>Description</td></tr>+ </thead>+ <tbody>++ <tr>+ <td>page_size</td>+ <td><a href="#int32">int32</a></td>+ <td></td>+ <td><p>Not used. The maximum number of histories to return.+The service may return fewer than this value.+If unspecified, at most 100 history entries will be returned.+The maximum value is 1000; values above 1000 will be coerced to 1000. </p></td>+ </tr>++ <tr>+ <td>page_token</td>+ <td><a href="#string">string</a></td>+ <td></td>+ <td><p>Not used. A page token, received from a previous `ListQueryHistory` call.+Provide this to retrieve the subsequent page. </p></td>+ </tr>++ <tr>+ <td>filter</td>+ <td><a href="#string">string</a></td>+ <td></td>+ <td><p>filter is the filter to apply on the search query history,+follow the [ebnf](https://en.wikipedia.org/wiki/Extended_Backus%E2%80%93Naur_form) syntax.+Support filter by:+- database, for example:+ database = "instances/{instance}/databases/{database}"+- instance, for example:+ instance = "instance/{instance}"+- type, for example:+ type = "QUERY" </p></td>+ </tr>++ </tbody>+ </table>++++++ <h3 id="bytebase.v1.SearchQueryHistoriesResponse">SearchQueryHistoriesResponse</h3>+ <p></p>+++ <table class="field-table">+ <thead>+ <tr><td>Field</td><td>Type</td><td>Label</td><td>Description</td></tr>+ </thead>+ <tbody>++ <tr>+ <td>query_histories</td>+ <td><a href="#bytebase.v1.QueryHistory">QueryHistory</a></td>+ <td>repeated</td>+ <td><p>The list of history. </p></td>+ </tr>++ <tr>+ <td>next_page_token</td>+ <td><a href="#string">string</a></td>+ <td></td>+ <td><p>A token to retrieve next page of history.+Pass this value in the page_token field in the subsequent call to `ListQueryHistory` method+to retrieve the next page of history. </p></td>+ </tr>++ </tbody>+ </table>+++++<h3 id="bytebase.v1.StringifyMetadataRequest">StringifyMetadataRequest</h3><p></p>@@ -26541,6 +26556,35 @@ The types come from the Golang SQL driver. </p></td></tbody></table>+ <h3 id="bytebase.v1.QueryHistory.Type">QueryHistory.Type</h3>+ <p></p>+ <table class="enum-table">+ <thead>+ <tr><td>Name</td><td>Number</td><td>Description</td></tr>+ </thead>+ <tbody>++ <tr>+ <td>TYPE_UNSPECIFIED</td>+ <td>0</td>+ <td><p></p></td>+ </tr>++ <tr>+ <td>QUERY</td>+ <td>1</td>+ <td><p></p></td>+ </tr>++ <tr>+ <td>EXPORT</td>+ <td>2</td>+ <td><p></p></td>+ </tr>++ </tbody>+ </table>+@@ -26561,9 +26605,9 @@ The types come from the Golang SQL driver. </p></td></tr><tr>- <td>ListQueryHistories</td>- <td><a href="#bytebase.v1.ListQueryHistoriesRequest">ListQueryHistoriesRequest</a></td>- <td><a href="#bytebase.v1.ListQueryHistoriesResponse">ListQueryHistoriesResponse</a></td>+ <td>SearchQueryHistories</td>+ <td><a href="#bytebase.v1.SearchQueryHistoriesRequest">SearchQueryHistoriesRequest</a></td>+ <td><a href="#bytebase.v1.SearchQueryHistoriesResponse">SearchQueryHistoriesResponse</a></td><td><p></p></td></tr>@@ -26654,9 +26698,9 @@ The types come from the Golang SQL driver. </p></td><tr>- <td>ListQueryHistories</td>+ <td>SearchQueryHistories</td><td>GET</td>- <td>/v1/queryHistories</td>+ <td>/v1/queryHistories:search</td><td></td></tr>diff --git a/proto/generated-go/store/query_history.pb.go b/proto/generated-go/store/query_history.pb.gonew file mode 100644index 0000000000..1238a50d4e--- /dev/null+++ b/proto/generated-go/store/query_history.pb.go@@ -0,0 +1,162 @@+// Code generated by protoc-gen-go. DO NOT EDIT.+// versions:+// protoc-gen-go v1.33.0+// protoc (unknown)+// source: store/query_history.proto++package store++import (+ protoreflect "google.golang.org/protobuf/reflect/protoreflect"+ protoimpl "google.golang.org/protobuf/runtime/protoimpl"+ durationpb "google.golang.org/protobuf/types/known/durationpb"+ reflect "reflect"+ sync "sync"+)++const (+ // Verify that this generated code is sufficiently up-to-date.+ _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)+ // Verify that runtime/protoimpl is sufficiently up-to-date.+ _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)+)++type QueryHistoryPayload struct {+ state protoimpl.MessageState+ sizeCache protoimpl.SizeCache+ unknownFields protoimpl.UnknownFields++ Error *string `protobuf:"bytes,1,opt,name=error,proto3,oneof" json:"error,omitempty"`+ Duration *durationpb.Duration `protobuf:"bytes,2,opt,name=duration,proto3" json:"duration,omitempty"`+}++func (x *QueryHistoryPayload) Reset() {+ *x = QueryHistoryPayload{}+ if protoimpl.UnsafeEnabled {+ mi := &file_store_query_history_proto_msgTypes[0]+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))+ ms.StoreMessageInfo(mi)+ }+}++func (x *QueryHistoryPayload) String() string {+ return protoimpl.X.MessageStringOf(x)+}++func (*QueryHistoryPayload) ProtoMessage() {}++func (x *QueryHistoryPayload) ProtoReflect() protoreflect.Message {+ mi := &file_store_query_history_proto_msgTypes[0]+ 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 QueryHistoryPayload.ProtoReflect.Descriptor instead.+func (*QueryHistoryPayload) Descriptor() ([]byte, []int) {+ return file_store_query_history_proto_rawDescGZIP(), []int{0}+}++func (x *QueryHistoryPayload) GetError() string {+ if x != nil && x.Error != nil {+ return *x.Error+ }+ return ""+}++func (x *QueryHistoryPayload) GetDuration() *durationpb.Duration {+ if x != nil {+ return x.Duration+ }+ return nil+}++var File_store_query_history_proto protoreflect.FileDescriptor++var file_store_query_history_proto_rawDesc = []byte{+ 0x0a, 0x19, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2f, 0x71, 0x75, 0x65, 0x72, 0x79, 0x5f, 0x68, 0x69,+ 0x73, 0x74, 0x6f, 0x72, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0e, 0x62, 0x79, 0x74,+ 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x1a, 0x1e, 0x67, 0x6f, 0x6f,+ 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x64, 0x75, 0x72,+ 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x71, 0x0a, 0x13, 0x51,+ 0x75, 0x65, 0x72, 0x79, 0x48, 0x69, 0x73, 0x74, 0x6f, 0x72, 0x79, 0x50, 0x61, 0x79, 0x6c, 0x6f,+ 0x61, 0x64, 0x12, 0x19, 0x0a, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28,+ 0x09, 0x48, 0x00, 0x52, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x88, 0x01, 0x01, 0x12, 0x35, 0x0a,+ 0x08, 0x64, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32,+ 0x19, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75,+ 0x66, 0x2e, 0x44, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x08, 0x64, 0x75, 0x72, 0x61,+ 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x42, 0x14,+ 0x5a, 0x12, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x2d, 0x67, 0x6f, 0x2f, 0x73,+ 0x74, 0x6f, 0x72, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,+}++var (+ file_store_query_history_proto_rawDescOnce sync.Once+ file_store_query_history_proto_rawDescData = file_store_query_history_proto_rawDesc+)++func file_store_query_history_proto_rawDescGZIP() []byte {+ file_store_query_history_proto_rawDescOnce.Do(func() {+ file_store_query_history_proto_rawDescData = protoimpl.X.CompressGZIP(file_store_query_history_proto_rawDescData)+ })+ return file_store_query_history_proto_rawDescData+}++var file_store_query_history_proto_msgTypes = make([]protoimpl.MessageInfo, 1)+var file_store_query_history_proto_goTypes = []interface{}{+ (*QueryHistoryPayload)(nil), // 0: bytebase.store.QueryHistoryPayload+ (*durationpb.Duration)(nil), // 1: google.protobuf.Duration+}+var file_store_query_history_proto_depIdxs = []int32{+ 1, // 0: bytebase.store.QueryHistoryPayload.duration:type_name -> google.protobuf.Duration+ 1, // [1:1] is the sub-list for method output_type+ 1, // [1:1] is the sub-list for method input_type+ 1, // [1:1] is the sub-list for extension type_name+ 1, // [1:1] is the sub-list for extension extendee+ 0, // [0:1] is the sub-list for field type_name+}++func init() { file_store_query_history_proto_init() }+func file_store_query_history_proto_init() {+ if File_store_query_history_proto != nil {+ return+ }+ if !protoimpl.UnsafeEnabled {+ file_store_query_history_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {+ switch v := v.(*QueryHistoryPayload); i {+ case 0:+ return &v.state+ case 1:+ return &v.sizeCache+ case 2:+ return &v.unknownFields+ default:+ return nil+ }+ }+ }+ file_store_query_history_proto_msgTypes[0].OneofWrappers = []interface{}{}+ type x struct{}+ out := protoimpl.TypeBuilder{+ File: protoimpl.DescBuilder{+ GoPackagePath: reflect.TypeOf(x{}).PkgPath(),+ RawDescriptor: file_store_query_history_proto_rawDesc,+ NumEnums: 0,+ NumMessages: 1,+ NumExtensions: 0,+ NumServices: 0,+ },+ GoTypes: file_store_query_history_proto_goTypes,+ DependencyIndexes: file_store_query_history_proto_depIdxs,+ MessageInfos: file_store_query_history_proto_msgTypes,+ }.Build()+ File_store_query_history_proto = out.File+ file_store_query_history_proto_rawDesc = nil+ file_store_query_history_proto_goTypes = nil+ file_store_query_history_proto_depIdxs = nil+}diff --git a/proto/generated-go/v1/sql_service.pb.go b/proto/generated-go/v1/sql_service.pb.goindex 45374af24f..85c72e8a05 100644--- a/proto/generated-go/v1/sql_service.pb.go+++ b/proto/generated-go/v1/sql_service.pb.go@@ -129,6 +129,55 @@ func (CheckRequest_ChangeType) EnumDescriptor() ([]byte, []int) {return file_v1_sql_service_proto_rawDescGZIP(), []int{14, 0}}+type QueryHistory_Type int32++const (+ QueryHistory_TYPE_UNSPECIFIED QueryHistory_Type = 0+ QueryHistory_QUERY QueryHistory_Type = 1+ QueryHistory_EXPORT QueryHistory_Type = 2+)++// Enum value maps for QueryHistory_Type.+var (+ QueryHistory_Type_name = map[int32]string{+ 0: "TYPE_UNSPECIFIED",+ 1: "QUERY",+ 2: "EXPORT",+ }+ QueryHistory_Type_value = map[string]int32{+ "TYPE_UNSPECIFIED": 0,+ "QUERY": 1,+ "EXPORT": 2,+ }+)++func (x QueryHistory_Type) Enum() *QueryHistory_Type {+ p := new(QueryHistory_Type)+ *p = x+ return p+}++func (x QueryHistory_Type) String() string {+ return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))+}++func (QueryHistory_Type) Descriptor() protoreflect.EnumDescriptor {+ return file_v1_sql_service_proto_enumTypes[2].Descriptor()+}++func (QueryHistory_Type) Type() protoreflect.EnumType {+ return &file_v1_sql_service_proto_enumTypes[2]+}++func (x QueryHistory_Type) Number() protoreflect.EnumNumber {+ return protoreflect.EnumNumber(x)+}++// Deprecated: Use QueryHistory_Type.Descriptor instead.+func (QueryHistory_Type) EnumDescriptor() ([]byte, []int) {+ return file_v1_sql_service_proto_rawDescGZIP(), []int{22, 0}+}+type DifferPreviewRequest struct {state protoimpl.MessageStatesizeCache protoimpl.SizeCache@@ -1601,7 +1650,7 @@ func (x *StringifyMetadataResponse) GetSchema() string {return ""}-type ListQueryHistoriesRequest struct {+type SearchQueryHistoriesRequest struct {state protoimpl.MessageStatesizeCache protoimpl.SizeCacheunknownFields protoimpl.UnknownFields@@ -1616,14 +1665,18 @@ type ListQueryHistoriesRequest struct {PageToken string `protobuf:"bytes,2,opt,name=page_token,json=pageToken,proto3" json:"page_token,omitempty"`// filter is the filter to apply on the search query history,// follow the [ebnf](https://en.wikipedia.org/wiki/Extended_Backus%E2%80%93Naur_form) syntax.- // Only support filter by database for now.- // For example:- // database = "instances/{instance}/databases/{database}"+ // Support filter by:+ // - database, for example:+ // database = "instances/{instance}/databases/{database}"+ // - instance, for example:+ // instance = "instance/{instance}"+ // - type, for example:+ // type = "QUERY"Filter string `protobuf:"bytes,3,opt,name=filter,proto3" json:"filter,omitempty"`}-func (x *ListQueryHistoriesRequest) Reset() {- *x = ListQueryHistoriesRequest{}+func (x *SearchQueryHistoriesRequest) Reset() {+ *x = SearchQueryHistoriesRequest{}if protoimpl.UnsafeEnabled {mi := &file_v1_sql_service_proto_msgTypes[20]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))@@ -1631,13 +1684,13 @@ func (x *ListQueryHistoriesRequest) Reset() {}}-func (x *ListQueryHistoriesRequest) String() string {+func (x *SearchQueryHistoriesRequest) String() string {return protoimpl.X.MessageStringOf(x)}-func (*ListQueryHistoriesRequest) ProtoMessage() {}+func (*SearchQueryHistoriesRequest) ProtoMessage() {}-func (x *ListQueryHistoriesRequest) ProtoReflect() protoreflect.Message {+func (x *SearchQueryHistoriesRequest) ProtoReflect() protoreflect.Message {mi := &file_v1_sql_service_proto_msgTypes[20]if protoimpl.UnsafeEnabled && x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))@@ -1649,33 +1702,33 @@ func (x *ListQueryHistoriesRequest) ProtoReflect() protoreflect.Message {return mi.MessageOf(x)}-// Deprecated: Use ListQueryHistoriesRequest.ProtoReflect.Descriptor instead.-func (*ListQueryHistoriesRequest) Descriptor() ([]byte, []int) {+// Deprecated: Use SearchQueryHistoriesRequest.ProtoReflect.Descriptor instead.+func (*SearchQueryHistoriesRequest) Descriptor() ([]byte, []int) {return file_v1_sql_service_proto_rawDescGZIP(), []int{20}}-func (x *ListQueryHistoriesRequest) GetPageSize() int32 {+func (x *SearchQueryHistoriesRequest) GetPageSize() int32 {if x != nil {return x.PageSize}return 0}-func (x *ListQueryHistoriesRequest) GetPageToken() string {+func (x *SearchQueryHistoriesRequest) GetPageToken() string {if x != nil {return x.PageToken}return ""}-func (x *ListQueryHistoriesRequest) GetFilter() string {+func (x *SearchQueryHistoriesRequest) GetFilter() string {if x != nil {return x.Filter}return ""}-type ListQueryHistoriesResponse struct {+type SearchQueryHistoriesResponse struct {state protoimpl.MessageStatesizeCache protoimpl.SizeCacheunknownFields protoimpl.UnknownFields@@ -1688,8 +1741,8 @@ type ListQueryHistoriesResponse struct {NextPageToken string `protobuf:"bytes,2,opt,name=next_page_token,json=nextPageToken,proto3" json:"next_page_token,omitempty"`}-func (x *ListQueryHistoriesResponse) Reset() {- *x = ListQueryHistoriesResponse{}+func (x *SearchQueryHistoriesResponse) Reset() {+ *x = SearchQueryHistoriesResponse{}if protoimpl.UnsafeEnabled {mi := &file_v1_sql_service_proto_msgTypes[21]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))@@ -1697,13 +1750,13 @@ func (x *ListQueryHistoriesResponse) Reset() {}}-func (x *ListQueryHistoriesResponse) String() string {+func (x *SearchQueryHistoriesResponse) String() string {return protoimpl.X.MessageStringOf(x)}-func (*ListQueryHistoriesResponse) ProtoMessage() {}+func (*SearchQueryHistoriesResponse) ProtoMessage() {}-func (x *ListQueryHistoriesResponse) ProtoReflect() protoreflect.Message {+func (x *SearchQueryHistoriesResponse) ProtoReflect() protoreflect.Message {mi := &file_v1_sql_service_proto_msgTypes[21]if protoimpl.UnsafeEnabled && x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))@@ -1715,19 +1768,19 @@ func (x *ListQueryHistoriesResponse) ProtoReflect() protoreflect.Message {return mi.MessageOf(x)}-// Deprecated: Use ListQueryHistoriesResponse.ProtoReflect.Descriptor instead.-func (*ListQueryHistoriesResponse) Descriptor() ([]byte, []int) {+// Deprecated: Use SearchQueryHistoriesResponse.ProtoReflect.Descriptor instead.+func (*SearchQueryHistoriesResponse) Descriptor() ([]byte, []int) {return file_v1_sql_service_proto_rawDescGZIP(), []int{21}}-func (x *ListQueryHistoriesResponse) GetQueryHistories() []*QueryHistory {+func (x *SearchQueryHistoriesResponse) GetQueryHistories() []*QueryHistory {if x != nil {return x.QueryHistories}return nil}-func (x *ListQueryHistoriesResponse) GetNextPageToken() string {+func (x *SearchQueryHistoriesResponse) GetNextPageToken() string {if x != nil {return x.NextPageToken}@@ -1750,6 +1803,7 @@ type QueryHistory struct {Statement string `protobuf:"bytes,5,opt,name=statement,proto3" json:"statement,omitempty"`Error *string `protobuf:"bytes,6,opt,name=error,proto3,oneof" json:"error,omitempty"`Duration *durationpb.Duration `protobuf:"bytes,7,opt,name=duration,proto3" json:"duration,omitempty"`+ Type QueryHistory_Type `protobuf:"varint,8,opt,name=type,proto3,enum=bytebase.v1.QueryHistory_Type" json:"type,omitempty"`}func (x *QueryHistory) Reset() {@@ -1833,6 +1887,13 @@ func (x *QueryHistory) GetDuration() *durationpb.Duration {return nil}+func (x *QueryHistory) GetType() QueryHistory_Type {+ if x != nil {+ return x.Type+ }+ return QueryHistory_TYPE_UNSPECIFIED+}+var File_v1_sql_service_proto protoreflect.FileDescriptorvar file_v1_sql_service_proto_rawDesc = []byte{@@ -2050,117 +2111,124 @@ var file_v1_sql_service_proto_rawDesc = []byte{0x72, 0x69, 0x6e, 0x67, 0x69, 0x66, 0x79, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x52,0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1b, 0x0a, 0x06, 0x73, 0x63, 0x68, 0x65, 0x6d,0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x03, 0xe0, 0x41, 0x03, 0x52, 0x06, 0x73, 0x63,- 0x68, 0x65, 0x6d, 0x61, 0x22, 0x6f, 0x0a, 0x19, 0x4c, 0x69, 0x73, 0x74, 0x51, 0x75, 0x65, 0x72,- 0x79, 0x48, 0x69, 0x73, 0x74, 0x6f, 0x72, 0x69, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73,- 0x74, 0x12, 0x1b, 0x0a, 0x09, 0x70, 0x61, 0x67, 0x65, 0x5f, 0x73, 0x69, 0x7a, 0x65, 0x18, 0x01,- 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x70, 0x61, 0x67, 0x65, 0x53, 0x69, 0x7a, 0x65, 0x12, 0x1d,- 0x0a, 0x0a, 0x70, 0x61, 0x67, 0x65, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x02, 0x20, 0x01,- 0x28, 0x09, 0x52, 0x09, 0x70, 0x61, 0x67, 0x65, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x16, 0x0a,- 0x06, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x66,- 0x69, 0x6c, 0x74, 0x65, 0x72, 0x22, 0x8d, 0x01, 0x0a, 0x1a, 0x4c, 0x69, 0x73, 0x74, 0x51, 0x75,- 0x65, 0x72, 0x79, 0x48, 0x69, 0x73, 0x74, 0x6f, 0x72, 0x69, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70,- 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x47, 0x0a, 0x0f, 0x71, 0x75, 0x65, 0x72, 0x79, 0x5f, 0x68, 0x69,- 0x73, 0x74, 0x6f, 0x72, 0x69, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x19, 0x2e,- 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x51, 0x75, 0x65, 0x72,- 0x79, 0x48, 0x69, 0x73, 0x74, 0x6f, 0x72, 0x79, 0x42, 0x03, 0xe0, 0x41, 0x03, 0x52, 0x0e, 0x71,- 0x75, 0x65, 0x72, 0x79, 0x48, 0x69, 0x73, 0x74, 0x6f, 0x72, 0x69, 0x65, 0x73, 0x12, 0x26, 0x0a,- 0x0f, 0x6e, 0x65, 0x78, 0x74, 0x5f, 0x70, 0x61, 0x67, 0x65, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e,- 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x6e, 0x65, 0x78, 0x74, 0x50, 0x61, 0x67, 0x65,- 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x22, 0xb2, 0x02, 0x0a, 0x0c, 0x51, 0x75, 0x65, 0x72, 0x79, 0x48,- 0x69, 0x73, 0x74, 0x6f, 0x72, 0x79, 0x12, 0x17, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01,- 0x20, 0x01, 0x28, 0x09, 0x42, 0x03, 0xe0, 0x41, 0x03, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12,- 0x1f, 0x0a, 0x08, 0x64, 0x61, 0x74, 0x61, 0x62, 0x61, 0x73, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28,- 0x09, 0x42, 0x03, 0xe0, 0x41, 0x03, 0x52, 0x08, 0x64, 0x61, 0x74, 0x61, 0x62, 0x61, 0x73, 0x65,- 0x12, 0x1d, 0x0a, 0x07, 0x63, 0x72, 0x65, 0x61, 0x74, 0x6f, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28,- 0x09, 0x42, 0x03, 0xe0, 0x41, 0x03, 0x52, 0x07, 0x63, 0x72, 0x65, 0x61, 0x74, 0x6f, 0x72, 0x12,- 0x40, 0x0a, 0x0b, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x04,- 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72,- 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70,- 0x42, 0x03, 0xe0, 0x41, 0x03, 0x52, 0x0a, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x54, 0x69, 0x6d,- 0x65, 0x12, 0x21, 0x0a, 0x09, 0x73, 0x74, 0x61, 0x74, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x05,- 0x20, 0x01, 0x28, 0x09, 0x42, 0x03, 0xe0, 0x41, 0x03, 0x52, 0x09, 0x73, 0x74, 0x61, 0x74, 0x65,- 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x1e, 0x0a, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x18, 0x06, 0x20,- 0x01, 0x28, 0x09, 0x42, 0x03, 0xe0, 0x41, 0x03, 0x48, 0x00, 0x52, 0x05, 0x65, 0x72, 0x72, 0x6f,- 0x72, 0x88, 0x01, 0x01, 0x12, 0x3a, 0x0a, 0x08, 0x64, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e,- 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e,- 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x44, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f,- 0x6e, 0x42, 0x03, 0xe0, 0x41, 0x03, 0x52, 0x08, 0x64, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e,- 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x32, 0x89, 0x09, 0x0a, 0x0a, 0x53,- 0x51, 0x4c, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x93, 0x01, 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, 0x53, 0x82, 0xd3, 0xe4, 0x93,- 0x02, 0x4d, 0x3a, 0x01, 0x2a, 0x5a, 0x1e, 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, 0x22, 0x28, 0x2f, 0x76, 0x31, 0x2f, 0x7b, 0x6e, 0x61, 0x6d, 0x65,- 0x3d, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x73, 0x2f, 0x2a, 0x2f, 0x64, 0x61, 0x74,- 0x61, 0x62, 0x61, 0x73, 0x65, 0x73, 0x2f, 0x2a, 0x7d, 0x3a, 0x71, 0x75, 0x65, 0x72, 0x79, 0x12,- 0x81, 0x01, 0x0a, 0x12, 0x4c, 0x69, 0x73, 0x74, 0x51, 0x75, 0x65, 0x72, 0x79, 0x48, 0x69, 0x73,- 0x74, 0x6f, 0x72, 0x69, 0x65, 0x73, 0x12, 0x26, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73,- 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x51, 0x75, 0x65, 0x72, 0x79, 0x48, 0x69,- 0x73, 0x74, 0x6f, 0x72, 0x69, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x27,- 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x4c, 0x69, 0x73,- 0x74, 0x51, 0x75, 0x65, 0x72, 0x79, 0x48, 0x69, 0x73, 0x74, 0x6f, 0x72, 0x69, 0x65, 0x73, 0x52,- 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x1a, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x14, 0x12,- 0x12, 0x2f, 0x76, 0x31, 0x2f, 0x71, 0x75, 0x65, 0x72, 0x79, 0x48, 0x69, 0x73, 0x74, 0x6f, 0x72,- 0x69, 0x65, 0x73, 0x12, 0x98, 0x01, 0x0a, 0x06, 0x45, 0x78, 0x70, 0x6f, 0x72, 0x74, 0x12, 0x1a,- 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x45, 0x78, 0x70,- 0x6f, 0x72, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1b, 0x2e, 0x62, 0x79, 0x74,- 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x45, 0x78, 0x70, 0x6f, 0x72, 0x74, 0x52,- 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x55, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x4f, 0x3a,- 0x01, 0x2a, 0x5a, 0x1f, 0x22, 0x1d, 0x2f, 0x76, 0x31, 0x2f, 0x7b, 0x6e, 0x61, 0x6d, 0x65, 0x3d,- 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x73, 0x2f, 0x2a, 0x7d, 0x3a, 0x65, 0x78, 0x70,- 0x6f, 0x72, 0x74, 0x22, 0x29, 0x2f, 0x76, 0x31, 0x2f, 0x7b, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x69,- 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x73, 0x2f, 0x2a, 0x2f, 0x64, 0x61, 0x74, 0x61, 0x62,- 0x61, 0x73, 0x65, 0x73, 0x2f, 0x2a, 0x7d, 0x3a, 0x65, 0x78, 0x70, 0x6f, 0x72, 0x74, 0x12, 0x71,- 0x0a, 0x0c, 0x41, 0x64, 0x6d, 0x69, 0x6e, 0x45, 0x78, 0x65, 0x63, 0x75, 0x74, 0x65, 0x12, 0x20,- 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x41, 0x64, 0x6d,- 0x69, 0x6e, 0x45, 0x78, 0x65, 0x63, 0x75, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74,- 0x1a, 0x21, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x41,- 0x64, 0x6d, 0x69, 0x6e, 0x45, 0x78, 0x65, 0x63, 0x75, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f,- 0x6e, 0x73, 0x65, 0x22, 0x18, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x12, 0x12, 0x10, 0x2f, 0x76, 0x31,- 0x3a, 0x61, 0x64, 0x6d, 0x69, 0x6e, 0x45, 0x78, 0x65, 0x63, 0x75, 0x74, 0x65, 0x28, 0x01, 0x30,- 0x01, 0x12, 0x78, 0x0a, 0x0d, 0x44, 0x69, 0x66, 0x66, 0x65, 0x72, 0x50, 0x72, 0x65, 0x76, 0x69,- 0x65, 0x77, 0x12, 0x21, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31,- 0x2e, 0x44, 0x69, 0x66, 0x66, 0x65, 0x72, 0x50, 0x72, 0x65, 0x76, 0x69, 0x65, 0x77, 0x52, 0x65,- 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x22, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65,- 0x2e, 0x76, 0x31, 0x2e, 0x44, 0x69, 0x66, 0x66, 0x65, 0x72, 0x50, 0x72, 0x65, 0x76, 0x69, 0x65,- 0x77, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x20, 0x82, 0xd3, 0xe4, 0x93, 0x02,- 0x1a, 0x3a, 0x01, 0x2a, 0x22, 0x15, 0x2f, 0x76, 0x31, 0x2f, 0x73, 0x71, 0x6c, 0x2f, 0x64, 0x69,- 0x66, 0x66, 0x65, 0x72, 0x50, 0x72, 0x65, 0x76, 0x69, 0x65, 0x77, 0x12, 0x58, 0x0a, 0x05, 0x43,- 0x68, 0x65, 0x63, 0x6b, 0x12, 0x19, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e,- 0x76, 0x31, 0x2e, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a,- 0x1a, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x68,- 0x65, 0x63, 0x6b, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x18, 0x82, 0xd3, 0xe4,- 0x93, 0x02, 0x12, 0x3a, 0x01, 0x2a, 0x22, 0x0d, 0x2f, 0x76, 0x31, 0x2f, 0x73, 0x71, 0x6c, 0x2f,- 0x63, 0x68, 0x65, 0x63, 0x6b, 0x12, 0x8c, 0x01, 0x0a, 0x12, 0x50, 0x61, 0x72, 0x73, 0x65, 0x4d,- 0x79, 0x42, 0x61, 0x74, 0x69, 0x73, 0x4d, 0x61, 0x70, 0x70, 0x65, 0x72, 0x12, 0x26, 0x2e, 0x62,- 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x50, 0x61, 0x72, 0x73, 0x65,- 0x4d, 0x79, 0x42, 0x61, 0x74, 0x69, 0x73, 0x4d, 0x61, 0x70, 0x70, 0x65, 0x72, 0x52, 0x65, 0x71,- 0x75, 0x65, 0x73, 0x74, 0x1a, 0x27, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e,- 0x76, 0x31, 0x2e, 0x50, 0x61, 0x72, 0x73, 0x65, 0x4d, 0x79, 0x42, 0x61, 0x74, 0x69, 0x73, 0x4d,- 0x61, 0x70, 0x70, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x25, 0x82,- 0xd3, 0xe4, 0x93, 0x02, 0x1f, 0x3a, 0x01, 0x2a, 0x22, 0x1a, 0x2f, 0x76, 0x31, 0x2f, 0x73, 0x71,- 0x6c, 0x2f, 0x70, 0x61, 0x72, 0x73, 0x65, 0x4d, 0x79, 0x42, 0x61, 0x74, 0x69, 0x73, 0x4d, 0x61,- 0x70, 0x70, 0x65, 0x72, 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, 0x91, 0x01, 0x0a, 0x11, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x69, 0x66, 0x79,- 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x12, 0x25, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62,- 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x69, 0x66, 0x79,- 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a,- 0x26, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x74,- 0x72, 0x69, 0x6e, 0x67, 0x69, 0x66, 0x79, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x52,- 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x2d, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x27, 0x3a,- 0x01, 0x2a, 0x22, 0x22, 0x2f, 0x76, 0x31, 0x2f, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x44, 0x65,- 0x73, 0x69, 0x67, 0x6e, 0x3a, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x69, 0x66, 0x79, 0x4d, 0x65,- 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 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,+ 0x68, 0x65, 0x6d, 0x61, 0x22, 0x71, 0x0a, 0x1b, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x51, 0x75,+ 0x65, 0x72, 0x79, 0x48, 0x69, 0x73, 0x74, 0x6f, 0x72, 0x69, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75,+ 0x65, 0x73, 0x74, 0x12, 0x1b, 0x0a, 0x09, 0x70, 0x61, 0x67, 0x65, 0x5f, 0x73, 0x69, 0x7a, 0x65,+ 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x70, 0x61, 0x67, 0x65, 0x53, 0x69, 0x7a, 0x65,+ 0x12, 0x1d, 0x0a, 0x0a, 0x70, 0x61, 0x67, 0x65, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x02,+ 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x70, 0x61, 0x67, 0x65, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x12,+ 0x16, 0x0a, 0x06, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52,+ 0x06, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x22, 0x8f, 0x01, 0x0a, 0x1c, 0x53, 0x65, 0x61, 0x72,+ 0x63, 0x68, 0x51, 0x75, 0x65, 0x72, 0x79, 0x48, 0x69, 0x73, 0x74, 0x6f, 0x72, 0x69, 0x65, 0x73,+ 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x47, 0x0a, 0x0f, 0x71, 0x75, 0x65, 0x72,+ 0x79, 0x5f, 0x68, 0x69, 0x73, 0x74, 0x6f, 0x72, 0x69, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28,+ 0x0b, 0x32, 0x19, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e,+ 0x51, 0x75, 0x65, 0x72, 0x79, 0x48, 0x69, 0x73, 0x74, 0x6f, 0x72, 0x79, 0x42, 0x03, 0xe0, 0x41,+ 0x03, 0x52, 0x0e, 0x71, 0x75, 0x65, 0x72, 0x79, 0x48, 0x69, 0x73, 0x74, 0x6f, 0x72, 0x69, 0x65,+ 0x73, 0x12, 0x26, 0x0a, 0x0f, 0x6e, 0x65, 0x78, 0x74, 0x5f, 0x70, 0x61, 0x67, 0x65, 0x5f, 0x74,+ 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x6e, 0x65, 0x78, 0x74,+ 0x50, 0x61, 0x67, 0x65, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x22, 0x9b, 0x03, 0x0a, 0x0c, 0x51, 0x75,+ 0x65, 0x72, 0x79, 0x48, 0x69, 0x73, 0x74, 0x6f, 0x72, 0x79, 0x12, 0x17, 0x0a, 0x04, 0x6e, 0x61,+ 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x03, 0xe0, 0x41, 0x03, 0x52, 0x04, 0x6e,+ 0x61, 0x6d, 0x65, 0x12, 0x1f, 0x0a, 0x08, 0x64, 0x61, 0x74, 0x61, 0x62, 0x61, 0x73, 0x65, 0x18,+ 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x03, 0xe0, 0x41, 0x03, 0x52, 0x08, 0x64, 0x61, 0x74, 0x61,+ 0x62, 0x61, 0x73, 0x65, 0x12, 0x1d, 0x0a, 0x07, 0x63, 0x72, 0x65, 0x61, 0x74, 0x6f, 0x72, 0x18,+ 0x03, 0x20, 0x01, 0x28, 0x09, 0x42, 0x03, 0xe0, 0x41, 0x03, 0x52, 0x07, 0x63, 0x72, 0x65, 0x61,+ 0x74, 0x6f, 0x72, 0x12, 0x40, 0x0a, 0x0b, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x5f, 0x74, 0x69,+ 0x6d, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c,+ 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73,+ 0x74, 0x61, 0x6d, 0x70, 0x42, 0x03, 0xe0, 0x41, 0x03, 0x52, 0x0a, 0x63, 0x72, 0x65, 0x61, 0x74,+ 0x65, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x21, 0x0a, 0x09, 0x73, 0x74, 0x61, 0x74, 0x65, 0x6d, 0x65,+ 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x42, 0x03, 0xe0, 0x41, 0x03, 0x52, 0x09, 0x73,+ 0x74, 0x61, 0x74, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x1e, 0x0a, 0x05, 0x65, 0x72, 0x72, 0x6f,+ 0x72, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x42, 0x03, 0xe0, 0x41, 0x03, 0x48, 0x00, 0x52, 0x05,+ 0x65, 0x72, 0x72, 0x6f, 0x72, 0x88, 0x01, 0x01, 0x12, 0x3a, 0x0a, 0x08, 0x64, 0x75, 0x72, 0x61,+ 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x67, 0x6f, 0x6f,+ 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x44, 0x75, 0x72,+ 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x03, 0xe0, 0x41, 0x03, 0x52, 0x08, 0x64, 0x75, 0x72, 0x61,+ 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x32, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x08, 0x20, 0x01,+ 0x28, 0x0e, 0x32, 0x1e, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31,+ 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x48, 0x69, 0x73, 0x74, 0x6f, 0x72, 0x79, 0x2e, 0x54, 0x79,+ 0x70, 0x65, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x22, 0x33, 0x0a, 0x04, 0x54, 0x79, 0x70, 0x65,+ 0x12, 0x14, 0x0a, 0x10, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49,+ 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x51, 0x55, 0x45, 0x52, 0x59, 0x10,+ 0x01, 0x12, 0x0a, 0x0a, 0x06, 0x45, 0x58, 0x50, 0x4f, 0x52, 0x54, 0x10, 0x02, 0x42, 0x08, 0x0a,+ 0x06, 0x5f, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x32, 0x96, 0x09, 0x0a, 0x0a, 0x53, 0x51, 0x4c, 0x53,+ 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x93, 0x01, 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, 0x53, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x4d, 0x3a,+ 0x01, 0x2a, 0x5a, 0x1e, 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, 0x22, 0x28, 0x2f, 0x76, 0x31, 0x2f, 0x7b, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x69, 0x6e,+ 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x73, 0x2f, 0x2a, 0x2f, 0x64, 0x61, 0x74, 0x61, 0x62, 0x61,+ 0x73, 0x65, 0x73, 0x2f, 0x2a, 0x7d, 0x3a, 0x71, 0x75, 0x65, 0x72, 0x79, 0x12, 0x8e, 0x01, 0x0a,+ 0x14, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x51, 0x75, 0x65, 0x72, 0x79, 0x48, 0x69, 0x73, 0x74,+ 0x6f, 0x72, 0x69, 0x65, 0x73, 0x12, 0x28, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65,+ 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x51, 0x75, 0x65, 0x72, 0x79, 0x48,+ 0x69, 0x73, 0x74, 0x6f, 0x72, 0x69, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a,+ 0x29, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x65,+ 0x61, 0x72, 0x63, 0x68, 0x51, 0x75, 0x65, 0x72, 0x79, 0x48, 0x69, 0x73, 0x74, 0x6f, 0x72, 0x69,+ 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x21, 0x82, 0xd3, 0xe4, 0x93,+ 0x02, 0x1b, 0x12, 0x19, 0x2f, 0x76, 0x31, 0x2f, 0x71, 0x75, 0x65, 0x72, 0x79, 0x48, 0x69, 0x73,+ 0x74, 0x6f, 0x72, 0x69, 0x65, 0x73, 0x3a, 0x73, 0x65, 0x61, 0x72, 0x63, 0x68, 0x12, 0x98, 0x01,+ 0x0a, 0x06, 0x45, 0x78, 0x70, 0x6f, 0x72, 0x74, 0x12, 0x1a, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62,+ 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x45, 0x78, 0x70, 0x6f, 0x72, 0x74, 0x52, 0x65, 0x71,+ 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1b, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e,+ 0x76, 0x31, 0x2e, 0x45, 0x78, 0x70, 0x6f, 0x72, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73,+ 0x65, 0x22, 0x55, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x4f, 0x3a, 0x01, 0x2a, 0x5a, 0x1f, 0x22, 0x1d,+ 0x2f, 0x76, 0x31, 0x2f, 0x7b, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6e,+ 0x63, 0x65, 0x73, 0x2f, 0x2a, 0x7d, 0x3a, 0x65, 0x78, 0x70, 0x6f, 0x72, 0x74, 0x22, 0x29, 0x2f,+ 0x76, 0x31, 0x2f, 0x7b, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63,+ 0x65, 0x73, 0x2f, 0x2a, 0x2f, 0x64, 0x61, 0x74, 0x61, 0x62, 0x61, 0x73, 0x65, 0x73, 0x2f, 0x2a,+ 0x7d, 0x3a, 0x65, 0x78, 0x70, 0x6f, 0x72, 0x74, 0x12, 0x71, 0x0a, 0x0c, 0x41, 0x64, 0x6d, 0x69,+ 0x6e, 0x45, 0x78, 0x65, 0x63, 0x75, 0x74, 0x65, 0x12, 0x20, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62,+ 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x41, 0x64, 0x6d, 0x69, 0x6e, 0x45, 0x78, 0x65, 0x63,+ 0x75, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x21, 0x2e, 0x62, 0x79, 0x74,+ 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x41, 0x64, 0x6d, 0x69, 0x6e, 0x45, 0x78,+ 0x65, 0x63, 0x75, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x18, 0x82,+ 0xd3, 0xe4, 0x93, 0x02, 0x12, 0x12, 0x10, 0x2f, 0x76, 0x31, 0x3a, 0x61, 0x64, 0x6d, 0x69, 0x6e,+ 0x45, 0x78, 0x65, 0x63, 0x75, 0x74, 0x65, 0x28, 0x01, 0x30, 0x01, 0x12, 0x78, 0x0a, 0x0d, 0x44,+ 0x69, 0x66, 0x66, 0x65, 0x72, 0x50, 0x72, 0x65, 0x76, 0x69, 0x65, 0x77, 0x12, 0x21, 0x2e, 0x62,+ 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x44, 0x69, 0x66, 0x66, 0x65,+ 0x72, 0x50, 0x72, 0x65, 0x76, 0x69, 0x65, 0x77, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a,+ 0x22, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x44, 0x69,+ 0x66, 0x66, 0x65, 0x72, 0x50, 0x72, 0x65, 0x76, 0x69, 0x65, 0x77, 0x52, 0x65, 0x73, 0x70, 0x6f,+ 0x6e, 0x73, 0x65, 0x22, 0x20, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1a, 0x3a, 0x01, 0x2a, 0x22, 0x15,+ 0x2f, 0x76, 0x31, 0x2f, 0x73, 0x71, 0x6c, 0x2f, 0x64, 0x69, 0x66, 0x66, 0x65, 0x72, 0x50, 0x72,+ 0x65, 0x76, 0x69, 0x65, 0x77, 0x12, 0x58, 0x0a, 0x05, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x12, 0x19,+ 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x68, 0x65,+ 0x63, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1a, 0x2e, 0x62, 0x79, 0x74, 0x65,+ 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x52, 0x65, 0x73,+ 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x18, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x12, 0x3a, 0x01, 0x2a,+ 0x22, 0x0d, 0x2f, 0x76, 0x31, 0x2f, 0x73, 0x71, 0x6c, 0x2f, 0x63, 0x68, 0x65, 0x63, 0x6b, 0x12,+ 0x8c, 0x01, 0x0a, 0x12, 0x50, 0x61, 0x72, 0x73, 0x65, 0x4d, 0x79, 0x42, 0x61, 0x74, 0x69, 0x73,+ 0x4d, 0x61, 0x70, 0x70, 0x65, 0x72, 0x12, 0x26, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73,+ 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x50, 0x61, 0x72, 0x73, 0x65, 0x4d, 0x79, 0x42, 0x61, 0x74, 0x69,+ 0x73, 0x4d, 0x61, 0x70, 0x70, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x27,+ 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x50, 0x61, 0x72,+ 0x73, 0x65, 0x4d, 0x79, 0x42, 0x61, 0x74, 0x69, 0x73, 0x4d, 0x61, 0x70, 0x70, 0x65, 0x72, 0x52,+ 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x25, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1f, 0x3a,+ 0x01, 0x2a, 0x22, 0x1a, 0x2f, 0x76, 0x31, 0x2f, 0x73, 0x71, 0x6c, 0x2f, 0x70, 0x61, 0x72, 0x73,+ 0x65, 0x4d, 0x79, 0x42, 0x61, 0x74, 0x69, 0x73, 0x4d, 0x61, 0x70, 0x70, 0x65, 0x72, 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, 0x91, 0x01, 0x0a,+ 0x11, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x69, 0x66, 0x79, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61,+ 0x74, 0x61, 0x12, 0x25, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31,+ 0x2e, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x69, 0x66, 0x79, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61,+ 0x74, 0x61, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x26, 0x2e, 0x62, 0x79, 0x74, 0x65,+ 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x69, 0x66,+ 0x79, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73,+ 0x65, 0x22, 0x2d, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x27, 0x3a, 0x01, 0x2a, 0x22, 0x22, 0x2f, 0x76,+ 0x31, 0x2f, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x44, 0x65, 0x73, 0x69, 0x67, 0x6e, 0x3a, 0x73,+ 0x74, 0x72, 0x69, 0x6e, 0x67, 0x69, 0x66, 0x79, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61,+ 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 (@@ -2175,89 +2243,91 @@ func file_v1_sql_service_proto_rawDescGZIP() []byte {return file_v1_sql_service_proto_rawDescData}-var file_v1_sql_service_proto_enumTypes = make([]protoimpl.EnumInfo, 2)+var file_v1_sql_service_proto_enumTypes = make([]protoimpl.EnumInfo, 3)var file_v1_sql_service_proto_msgTypes = make([]protoimpl.MessageInfo, 23)var file_v1_sql_service_proto_goTypes = []interface{}{- (Advice_Status)(0), // 0: bytebase.v1.Advice.Status- (CheckRequest_ChangeType)(0), // 1: bytebase.v1.CheckRequest.ChangeType- (*DifferPreviewRequest)(nil), // 2: bytebase.v1.DifferPreviewRequest- (*DifferPreviewResponse)(nil), // 3: bytebase.v1.DifferPreviewResponse- (*AdminExecuteRequest)(nil), // 4: bytebase.v1.AdminExecuteRequest- (*AdminExecuteResponse)(nil), // 5: bytebase.v1.AdminExecuteResponse- (*ExportRequest)(nil), // 6: bytebase.v1.ExportRequest- (*ExportResponse)(nil), // 7: bytebase.v1.ExportResponse- (*QueryRequest)(nil), // 8: bytebase.v1.QueryRequest- (*QueryResponse)(nil), // 9: bytebase.v1.QueryResponse- (*QueryResult)(nil), // 10: bytebase.v1.QueryResult- (*QueryRow)(nil), // 11: bytebase.v1.QueryRow- (*RowValue)(nil), // 12: bytebase.v1.RowValue- (*Advice)(nil), // 13: bytebase.v1.Advice- (*PrettyRequest)(nil), // 14: bytebase.v1.PrettyRequest- (*PrettyResponse)(nil), // 15: bytebase.v1.PrettyResponse- (*CheckRequest)(nil), // 16: bytebase.v1.CheckRequest- (*CheckResponse)(nil), // 17: bytebase.v1.CheckResponse- (*ParseMyBatisMapperRequest)(nil), // 18: bytebase.v1.ParseMyBatisMapperRequest- (*ParseMyBatisMapperResponse)(nil), // 19: bytebase.v1.ParseMyBatisMapperResponse- (*StringifyMetadataRequest)(nil), // 20: bytebase.v1.StringifyMetadataRequest- (*StringifyMetadataResponse)(nil), // 21: bytebase.v1.StringifyMetadataResponse- (*ListQueryHistoriesRequest)(nil), // 22: bytebase.v1.ListQueryHistoriesRequest- (*ListQueryHistoriesResponse)(nil), // 23: bytebase.v1.ListQueryHistoriesResponse- (*QueryHistory)(nil), // 24: bytebase.v1.QueryHistory- (Engine)(0), // 25: bytebase.v1.Engine- (*DatabaseMetadata)(nil), // 26: bytebase.v1.DatabaseMetadata- (*durationpb.Duration)(nil), // 27: google.protobuf.Duration- (ExportFormat)(0), // 28: bytebase.v1.ExportFormat- (structpb.NullValue)(0), // 29: google.protobuf.NullValue- (*structpb.Value)(nil), // 30: google.protobuf.Value- (*timestamppb.Timestamp)(nil), // 31: google.protobuf.Timestamp+ (Advice_Status)(0), // 0: bytebase.v1.Advice.Status+ (CheckRequest_ChangeType)(0), // 1: bytebase.v1.CheckRequest.ChangeType+ (QueryHistory_Type)(0), // 2: bytebase.v1.QueryHistory.Type+ (*DifferPreviewRequest)(nil), // 3: bytebase.v1.DifferPreviewRequest+ (*DifferPreviewResponse)(nil), // 4: bytebase.v1.DifferPreviewResponse+ (*AdminExecuteRequest)(nil), // 5: bytebase.v1.AdminExecuteRequest+ (*AdminExecuteResponse)(nil), // 6: bytebase.v1.AdminExecuteResponse+ (*ExportRequest)(nil), // 7: bytebase.v1.ExportRequest+ (*ExportResponse)(nil), // 8: bytebase.v1.ExportResponse+ (*QueryRequest)(nil), // 9: bytebase.v1.QueryRequest+ (*QueryResponse)(nil), // 10: bytebase.v1.QueryResponse+ (*QueryResult)(nil), // 11: bytebase.v1.QueryResult+ (*QueryRow)(nil), // 12: bytebase.v1.QueryRow+ (*RowValue)(nil), // 13: bytebase.v1.RowValue+ (*Advice)(nil), // 14: bytebase.v1.Advice+ (*PrettyRequest)(nil), // 15: bytebase.v1.PrettyRequest+ (*PrettyResponse)(nil), // 16: bytebase.v1.PrettyResponse+ (*CheckRequest)(nil), // 17: bytebase.v1.CheckRequest+ (*CheckResponse)(nil), // 18: bytebase.v1.CheckResponse+ (*ParseMyBatisMapperRequest)(nil), // 19: bytebase.v1.ParseMyBatisMapperRequest+ (*ParseMyBatisMapperResponse)(nil), // 20: bytebase.v1.ParseMyBatisMapperResponse+ (*StringifyMetadataRequest)(nil), // 21: bytebase.v1.StringifyMetadataRequest+ (*StringifyMetadataResponse)(nil), // 22: bytebase.v1.StringifyMetadataResponse+ (*SearchQueryHistoriesRequest)(nil), // 23: bytebase.v1.SearchQueryHistoriesRequest+ (*SearchQueryHistoriesResponse)(nil), // 24: bytebase.v1.SearchQueryHistoriesResponse+ (*QueryHistory)(nil), // 25: bytebase.v1.QueryHistory+ (Engine)(0), // 26: bytebase.v1.Engine+ (*DatabaseMetadata)(nil), // 27: bytebase.v1.DatabaseMetadata+ (*durationpb.Duration)(nil), // 28: google.protobuf.Duration+ (ExportFormat)(0), // 29: bytebase.v1.ExportFormat+ (structpb.NullValue)(0), // 30: google.protobuf.NullValue+ (*structpb.Value)(nil), // 31: google.protobuf.Value+ (*timestamppb.Timestamp)(nil), // 32: google.protobuf.Timestamp}var file_v1_sql_service_proto_depIdxs = []int32{- 25, // 0: bytebase.v1.DifferPreviewRequest.engine:type_name -> bytebase.v1.Engine- 26, // 1: bytebase.v1.DifferPreviewRequest.new_metadata:type_name -> bytebase.v1.DatabaseMetadata- 27, // 2: bytebase.v1.AdminExecuteRequest.timeout:type_name -> google.protobuf.Duration- 10, // 3: bytebase.v1.AdminExecuteResponse.results:type_name -> bytebase.v1.QueryResult- 28, // 4: bytebase.v1.ExportRequest.format:type_name -> bytebase.v1.ExportFormat- 27, // 5: bytebase.v1.QueryRequest.timeout:type_name -> google.protobuf.Duration- 10, // 6: bytebase.v1.QueryResponse.results:type_name -> bytebase.v1.QueryResult- 13, // 7: bytebase.v1.QueryResponse.advices:type_name -> bytebase.v1.Advice- 11, // 8: bytebase.v1.QueryResult.rows:type_name -> bytebase.v1.QueryRow- 27, // 9: bytebase.v1.QueryResult.latency:type_name -> google.protobuf.Duration- 12, // 10: bytebase.v1.QueryRow.values:type_name -> bytebase.v1.RowValue- 29, // 11: bytebase.v1.RowValue.null_value:type_name -> google.protobuf.NullValue- 30, // 12: bytebase.v1.RowValue.value_value:type_name -> google.protobuf.Value+ 26, // 0: bytebase.v1.DifferPreviewRequest.engine:type_name -> bytebase.v1.Engine+ 27, // 1: bytebase.v1.DifferPreviewRequest.new_metadata:type_name -> bytebase.v1.DatabaseMetadata+ 28, // 2: bytebase.v1.AdminExecuteRequest.timeout:type_name -> google.protobuf.Duration+ 11, // 3: bytebase.v1.AdminExecuteResponse.results:type_name -> bytebase.v1.QueryResult+ 29, // 4: bytebase.v1.ExportRequest.format:type_name -> bytebase.v1.ExportFormat+ 28, // 5: bytebase.v1.QueryRequest.timeout:type_name -> google.protobuf.Duration+ 11, // 6: bytebase.v1.QueryResponse.results:type_name -> bytebase.v1.QueryResult+ 14, // 7: bytebase.v1.QueryResponse.advices:type_name -> bytebase.v1.Advice+ 12, // 8: bytebase.v1.QueryResult.rows:type_name -> bytebase.v1.QueryRow+ 28, // 9: bytebase.v1.QueryResult.latency:type_name -> google.protobuf.Duration+ 13, // 10: bytebase.v1.QueryRow.values:type_name -> bytebase.v1.RowValue+ 30, // 11: bytebase.v1.RowValue.null_value:type_name -> google.protobuf.NullValue+ 31, // 12: bytebase.v1.RowValue.value_value:type_name -> google.protobuf.Value0, // 13: bytebase.v1.Advice.status:type_name -> bytebase.v1.Advice.Status- 25, // 14: bytebase.v1.PrettyRequest.engine:type_name -> bytebase.v1.Engine- 26, // 15: bytebase.v1.CheckRequest.metadata:type_name -> bytebase.v1.DatabaseMetadata+ 26, // 14: bytebase.v1.PrettyRequest.engine:type_name -> bytebase.v1.Engine+ 27, // 15: bytebase.v1.CheckRequest.metadata:type_name -> bytebase.v1.DatabaseMetadata1, // 16: bytebase.v1.CheckRequest.change_type:type_name -> bytebase.v1.CheckRequest.ChangeType- 13, // 17: bytebase.v1.CheckResponse.advices:type_name -> bytebase.v1.Advice- 26, // 18: bytebase.v1.StringifyMetadataRequest.metadata:type_name -> bytebase.v1.DatabaseMetadata- 25, // 19: bytebase.v1.StringifyMetadataRequest.engine:type_name -> bytebase.v1.Engine- 24, // 20: bytebase.v1.ListQueryHistoriesResponse.query_histories:type_name -> bytebase.v1.QueryHistory- 31, // 21: bytebase.v1.QueryHistory.create_time:type_name -> google.protobuf.Timestamp- 27, // 22: bytebase.v1.QueryHistory.duration:type_name -> google.protobuf.Duration- 8, // 23: bytebase.v1.SQLService.Query:input_type -> bytebase.v1.QueryRequest- 22, // 24: bytebase.v1.SQLService.ListQueryHistories:input_type -> bytebase.v1.ListQueryHistoriesRequest- 6, // 25: bytebase.v1.SQLService.Export:input_type -> bytebase.v1.ExportRequest- 4, // 26: bytebase.v1.SQLService.AdminExecute:input_type -> bytebase.v1.AdminExecuteRequest- 2, // 27: bytebase.v1.SQLService.DifferPreview:input_type -> bytebase.v1.DifferPreviewRequest- 16, // 28: bytebase.v1.SQLService.Check:input_type -> bytebase.v1.CheckRequest- 18, // 29: bytebase.v1.SQLService.ParseMyBatisMapper:input_type -> bytebase.v1.ParseMyBatisMapperRequest- 14, // 30: bytebase.v1.SQLService.Pretty:input_type -> bytebase.v1.PrettyRequest- 20, // 31: bytebase.v1.SQLService.StringifyMetadata:input_type -> bytebase.v1.StringifyMetadataRequest- 9, // 32: bytebase.v1.SQLService.Query:output_type -> bytebase.v1.QueryResponse- 23, // 33: bytebase.v1.SQLService.ListQueryHistories:output_type -> bytebase.v1.ListQueryHistoriesResponse- 7, // 34: bytebase.v1.SQLService.Export:output_type -> bytebase.v1.ExportResponse- 5, // 35: bytebase.v1.SQLService.AdminExecute:output_type -> bytebase.v1.AdminExecuteResponse- 3, // 36: bytebase.v1.SQLService.DifferPreview:output_type -> bytebase.v1.DifferPreviewResponse- 17, // 37: bytebase.v1.SQLService.Check:output_type -> bytebase.v1.CheckResponse- 19, // 38: bytebase.v1.SQLService.ParseMyBatisMapper:output_type -> bytebase.v1.ParseMyBatisMapperResponse- 15, // 39: bytebase.v1.SQLService.Pretty:output_type -> bytebase.v1.PrettyResponse- 21, // 40: bytebase.v1.SQLService.StringifyMetadata:output_type -> bytebase.v1.StringifyMetadataResponse- 32, // [32:41] is the sub-list for method output_type- 23, // [23:32] is the sub-list for method input_type- 23, // [23:23] is the sub-list for extension type_name- 23, // [23:23] is the sub-list for extension extendee- 0, // [0:23] is the sub-list for field type_name+ 14, // 17: bytebase.v1.CheckResponse.advices:type_name -> bytebase.v1.Advice+ 27, // 18: bytebase.v1.StringifyMetadataRequest.metadata:type_name -> bytebase.v1.DatabaseMetadata+ 26, // 19: bytebase.v1.StringifyMetadataRequest.engine:type_name -> bytebase.v1.Engine+ 25, // 20: bytebase.v1.SearchQueryHistoriesResponse.query_histories:type_name -> bytebase.v1.QueryHistory+ 32, // 21: bytebase.v1.QueryHistory.create_time:type_name -> google.protobuf.Timestamp+ 28, // 22: bytebase.v1.QueryHistory.duration:type_name -> google.protobuf.Duration+ 2, // 23: bytebase.v1.QueryHistory.type:type_name -> bytebase.v1.QueryHistory.Type+ 9, // 24: bytebase.v1.SQLService.Query:input_type -> bytebase.v1.QueryRequest+ 23, // 25: bytebase.v1.SQLService.SearchQueryHistories:input_type -> bytebase.v1.SearchQueryHistoriesRequest+ 7, // 26: bytebase.v1.SQLService.Export:input_type -> bytebase.v1.ExportRequest+ 5, // 27: bytebase.v1.SQLService.AdminExecute:input_type -> bytebase.v1.AdminExecuteRequest+ 3, // 28: bytebase.v1.SQLService.DifferPreview:input_type -> bytebase.v1.DifferPreviewRequest+ 17, // 29: bytebase.v1.SQLService.Check:input_type -> bytebase.v1.CheckRequest+ 19, // 30: bytebase.v1.SQLService.ParseMyBatisMapper:input_type -> bytebase.v1.ParseMyBatisMapperRequest+ 15, // 31: bytebase.v1.SQLService.Pretty:input_type -> bytebase.v1.PrettyRequest+ 21, // 32: bytebase.v1.SQLService.StringifyMetadata:input_type -> bytebase.v1.StringifyMetadataRequest+ 10, // 33: bytebase.v1.SQLService.Query:output_type -> bytebase.v1.QueryResponse+ 24, // 34: bytebase.v1.SQLService.SearchQueryHistories:output_type -> bytebase.v1.SearchQueryHistoriesResponse+ 8, // 35: bytebase.v1.SQLService.Export:output_type -> bytebase.v1.ExportResponse+ 6, // 36: bytebase.v1.SQLService.AdminExecute:output_type -> bytebase.v1.AdminExecuteResponse+ 4, // 37: bytebase.v1.SQLService.DifferPreview:output_type -> bytebase.v1.DifferPreviewResponse+ 18, // 38: bytebase.v1.SQLService.Check:output_type -> bytebase.v1.CheckResponse+ 20, // 39: bytebase.v1.SQLService.ParseMyBatisMapper:output_type -> bytebase.v1.ParseMyBatisMapperResponse+ 16, // 40: bytebase.v1.SQLService.Pretty:output_type -> bytebase.v1.PrettyResponse+ 22, // 41: bytebase.v1.SQLService.StringifyMetadata:output_type -> bytebase.v1.StringifyMetadataResponse+ 33, // [33:42] is the sub-list for method output_type+ 24, // [24:33] is the sub-list for method input_type+ 24, // [24:24] is the sub-list for extension type_name+ 24, // [24:24] is the sub-list for extension extendee+ 0, // [0:24] is the sub-list for field type_name}func init() { file_v1_sql_service_proto_init() }@@ -2509,7 +2579,7 @@ func file_v1_sql_service_proto_init() {}}file_v1_sql_service_proto_msgTypes[20].Exporter = func(v interface{}, i int) interface{} {- switch v := v.(*ListQueryHistoriesRequest); i {+ switch v := v.(*SearchQueryHistoriesRequest); i {case 0:return &v.statecase 1:@@ -2521,7 +2591,7 @@ func file_v1_sql_service_proto_init() {}}file_v1_sql_service_proto_msgTypes[21].Exporter = func(v interface{}, i int) interface{} {- switch v := v.(*ListQueryHistoriesResponse); i {+ switch v := v.(*SearchQueryHistoriesResponse); i {case 0:return &v.statecase 1:@@ -2565,7 +2635,7 @@ func file_v1_sql_service_proto_init() {File: protoimpl.DescBuilder{GoPackagePath: reflect.TypeOf(x{}).PkgPath(),RawDescriptor: file_v1_sql_service_proto_rawDesc,- NumEnums: 2,+ NumEnums: 3,NumMessages: 23,NumExtensions: 0,NumServices: 1,diff --git a/proto/generated-go/v1/sql_service.pb.gw.go b/proto/generated-go/v1/sql_service.pb.gw.goindex b39ba7d2c6..7a73e00560 100644--- a/proto/generated-go/v1/sql_service.pb.gw.go+++ b/proto/generated-go/v1/sql_service.pb.gw.go@@ -162,37 +162,37 @@ func local_request_SQLService_Query_1(ctx context.Context, marshaler runtime.Mar}var (- filter_SQLService_ListQueryHistories_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)}+ filter_SQLService_SearchQueryHistories_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)})-func request_SQLService_ListQueryHistories_0(ctx context.Context, marshaler runtime.Marshaler, client SQLServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {- var protoReq ListQueryHistoriesRequest+func request_SQLService_SearchQueryHistories_0(ctx context.Context, marshaler runtime.Marshaler, client SQLServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {+ var protoReq SearchQueryHistoriesRequestvar metadata runtime.ServerMetadataif err := req.ParseForm(); err != nil {return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)}- if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_SQLService_ListQueryHistories_0); err != nil {+ if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_SQLService_SearchQueryHistories_0); err != nil {return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)}- msg, err := client.ListQueryHistories(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))+ msg, err := client.SearchQueryHistories(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))return msg, metadata, err}-func local_request_SQLService_ListQueryHistories_0(ctx context.Context, marshaler runtime.Marshaler, server SQLServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {- var protoReq ListQueryHistoriesRequest+func local_request_SQLService_SearchQueryHistories_0(ctx context.Context, marshaler runtime.Marshaler, server SQLServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {+ var protoReq SearchQueryHistoriesRequestvar metadata runtime.ServerMetadataif err := req.ParseForm(); err != nil {return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)}- if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_SQLService_ListQueryHistories_0); err != nil {+ if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_SQLService_SearchQueryHistories_0); err != nil {return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)}- msg, err := server.ListQueryHistories(ctx, &protoReq)+ msg, err := server.SearchQueryHistories(ctx, &protoReq)return msg, metadata, err}@@ -556,7 +556,7 @@ func RegisterSQLServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux,})- mux.Handle("GET", pattern_SQLService_ListQueryHistories_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {+ mux.Handle("GET", pattern_SQLService_SearchQueryHistories_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {ctx, cancel := context.WithCancel(req.Context())defer cancel()var stream runtime.ServerTransportStream@@ -564,12 +564,12 @@ func RegisterSQLServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux,inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)var err errorvar annotatedContext context.Context- annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/bytebase.v1.SQLService/ListQueryHistories", runtime.WithHTTPPathPattern("/v1/queryHistories"))+ annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/bytebase.v1.SQLService/SearchQueryHistories", runtime.WithHTTPPathPattern("/v1/queryHistories:search"))if err != nil {runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)return}- resp, md, err := local_request_SQLService_ListQueryHistories_0(annotatedContext, inboundMarshaler, server, req, pathParams)+ resp, md, err := local_request_SQLService_SearchQueryHistories_0(annotatedContext, inboundMarshaler, server, req, pathParams)md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)if err != nil {@@ -577,7 +577,7 @@ func RegisterSQLServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux,return}- forward_SQLService_ListQueryHistories_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)+ forward_SQLService_SearchQueryHistories_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)})@@ -848,25 +848,25 @@ func RegisterSQLServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux,})- mux.Handle("GET", pattern_SQLService_ListQueryHistories_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {+ mux.Handle("GET", pattern_SQLService_SearchQueryHistories_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {ctx, cancel := context.WithCancel(req.Context())defer cancel()inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)var err errorvar annotatedContext context.Context- annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/bytebase.v1.SQLService/ListQueryHistories", runtime.WithHTTPPathPattern("/v1/queryHistories"))+ annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/bytebase.v1.SQLService/SearchQueryHistories", runtime.WithHTTPPathPattern("/v1/queryHistories:search"))if err != nil {runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)return}- resp, md, err := request_SQLService_ListQueryHistories_0(annotatedContext, inboundMarshaler, client, req, pathParams)+ resp, md, err := request_SQLService_SearchQueryHistories_0(annotatedContext, inboundMarshaler, client, req, pathParams)annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)if err != nil {runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)return}- forward_SQLService_ListQueryHistories_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)+ forward_SQLService_SearchQueryHistories_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)})@@ -1054,7 +1054,7 @@ var (pattern_SQLService_Query_1 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 2, 5, 2}, []string{"v1", "instances", "name"}, "query"))- pattern_SQLService_ListQueryHistories_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"v1", "queryHistories"}, ""))+ pattern_SQLService_SearchQueryHistories_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"v1", "queryHistories"}, "search"))pattern_SQLService_Export_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 2, 2, 1, 0, 4, 4, 5, 3}, []string{"v1", "instances", "databases", "name"}, "export"))@@ -1078,7 +1078,7 @@ var (forward_SQLService_Query_1 = runtime.ForwardResponseMessage- forward_SQLService_ListQueryHistories_0 = runtime.ForwardResponseMessage+ forward_SQLService_SearchQueryHistories_0 = runtime.ForwardResponseMessageforward_SQLService_Export_0 = runtime.ForwardResponseMessagediff --git a/proto/generated-go/v1/sql_service_grpc.pb.go b/proto/generated-go/v1/sql_service_grpc.pb.goindex 90bed6beaa..2127d34ea8 100644--- a/proto/generated-go/v1/sql_service_grpc.pb.go+++ b/proto/generated-go/v1/sql_service_grpc.pb.go@@ -19,15 +19,15 @@ import (const _ = grpc.SupportPackageIsVersion7const (- SQLService_Query_FullMethodName = "/bytebase.v1.SQLService/Query"- SQLService_ListQueryHistories_FullMethodName = "/bytebase.v1.SQLService/ListQueryHistories"- SQLService_Export_FullMethodName = "/bytebase.v1.SQLService/Export"- SQLService_AdminExecute_FullMethodName = "/bytebase.v1.SQLService/AdminExecute"- SQLService_DifferPreview_FullMethodName = "/bytebase.v1.SQLService/DifferPreview"- SQLService_Check_FullMethodName = "/bytebase.v1.SQLService/Check"- SQLService_ParseMyBatisMapper_FullMethodName = "/bytebase.v1.SQLService/ParseMyBatisMapper"- SQLService_Pretty_FullMethodName = "/bytebase.v1.SQLService/Pretty"- SQLService_StringifyMetadata_FullMethodName = "/bytebase.v1.SQLService/StringifyMetadata"+ SQLService_Query_FullMethodName = "/bytebase.v1.SQLService/Query"+ SQLService_SearchQueryHistories_FullMethodName = "/bytebase.v1.SQLService/SearchQueryHistories"+ SQLService_Export_FullMethodName = "/bytebase.v1.SQLService/Export"+ SQLService_AdminExecute_FullMethodName = "/bytebase.v1.SQLService/AdminExecute"+ SQLService_DifferPreview_FullMethodName = "/bytebase.v1.SQLService/DifferPreview"+ SQLService_Check_FullMethodName = "/bytebase.v1.SQLService/Check"+ SQLService_ParseMyBatisMapper_FullMethodName = "/bytebase.v1.SQLService/ParseMyBatisMapper"+ SQLService_Pretty_FullMethodName = "/bytebase.v1.SQLService/Pretty"+ SQLService_StringifyMetadata_FullMethodName = "/bytebase.v1.SQLService/StringifyMetadata")// SQLServiceClient is the client API for SQLService service.@@ -35,7 +35,7 @@ const (// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.type SQLServiceClient interface {Query(ctx context.Context, in *QueryRequest, opts ...grpc.CallOption) (*QueryResponse, error)- ListQueryHistories(ctx context.Context, in *ListQueryHistoriesRequest, opts ...grpc.CallOption) (*ListQueryHistoriesResponse, error)+ SearchQueryHistories(ctx context.Context, in *SearchQueryHistoriesRequest, opts ...grpc.CallOption) (*SearchQueryHistoriesResponse, error)Export(ctx context.Context, in *ExportRequest, opts ...grpc.CallOption) (*ExportResponse, error)AdminExecute(ctx context.Context, opts ...grpc.CallOption) (SQLService_AdminExecuteClient, error)DifferPreview(ctx context.Context, in *DifferPreviewRequest, opts ...grpc.CallOption) (*DifferPreviewResponse, error)@@ -62,9 +62,9 @@ func (c *sQLServiceClient) Query(ctx context.Context, in *QueryRequest, opts ...return out, nil}-func (c *sQLServiceClient) ListQueryHistories(ctx context.Context, in *ListQueryHistoriesRequest, opts ...grpc.CallOption) (*ListQueryHistoriesResponse, error) {- out := new(ListQueryHistoriesResponse)- err := c.cc.Invoke(ctx, SQLService_ListQueryHistories_FullMethodName, in, out, opts...)+func (c *sQLServiceClient) SearchQueryHistories(ctx context.Context, in *SearchQueryHistoriesRequest, opts ...grpc.CallOption) (*SearchQueryHistoriesResponse, error) {+ out := new(SearchQueryHistoriesResponse)+ err := c.cc.Invoke(ctx, SQLService_SearchQueryHistories_FullMethodName, in, out, opts...)if err != nil {return nil, err}@@ -161,7 +161,7 @@ func (c *sQLServiceClient) StringifyMetadata(ctx context.Context, in *StringifyM// for forward compatibilitytype SQLServiceServer interface {Query(context.Context, *QueryRequest) (*QueryResponse, error)- ListQueryHistories(context.Context, *ListQueryHistoriesRequest) (*ListQueryHistoriesResponse, error)+ SearchQueryHistories(context.Context, *SearchQueryHistoriesRequest) (*SearchQueryHistoriesResponse, error)Export(context.Context, *ExportRequest) (*ExportResponse, error)AdminExecute(SQLService_AdminExecuteServer) errorDifferPreview(context.Context, *DifferPreviewRequest) (*DifferPreviewResponse, error)@@ -179,8 +179,8 @@ type UnimplementedSQLServiceServer struct {func (UnimplementedSQLServiceServer) Query(context.Context, *QueryRequest) (*QueryResponse, error) {return nil, status.Errorf(codes.Unimplemented, "method Query not implemented")}-func (UnimplementedSQLServiceServer) ListQueryHistories(context.Context, *ListQueryHistoriesRequest) (*ListQueryHistoriesResponse, error) {- return nil, status.Errorf(codes.Unimplemented, "method ListQueryHistories not implemented")+func (UnimplementedSQLServiceServer) SearchQueryHistories(context.Context, *SearchQueryHistoriesRequest) (*SearchQueryHistoriesResponse, error) {+ return nil, status.Errorf(codes.Unimplemented, "method SearchQueryHistories not implemented")}func (UnimplementedSQLServiceServer) Export(context.Context, *ExportRequest) (*ExportResponse, error) {return nil, status.Errorf(codes.Unimplemented, "method Export not implemented")@@ -234,20 +234,20 @@ func _SQLService_Query_Handler(srv interface{}, ctx context.Context, dec func(inreturn interceptor(ctx, in, info, handler)}-func _SQLService_ListQueryHistories_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {- in := new(ListQueryHistoriesRequest)+func _SQLService_SearchQueryHistories_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {+ in := new(SearchQueryHistoriesRequest)if err := dec(in); err != nil {return nil, err}if interceptor == nil {- return srv.(SQLServiceServer).ListQueryHistories(ctx, in)+ return srv.(SQLServiceServer).SearchQueryHistories(ctx, in)}info := &grpc.UnaryServerInfo{Server: srv,- FullMethod: SQLService_ListQueryHistories_FullMethodName,+ FullMethod: SQLService_SearchQueryHistories_FullMethodName,}handler := func(ctx context.Context, req interface{}) (interface{}, error) {- return srv.(SQLServiceServer).ListQueryHistories(ctx, req.(*ListQueryHistoriesRequest))+ return srv.(SQLServiceServer).SearchQueryHistories(ctx, req.(*SearchQueryHistoriesRequest))}return interceptor(ctx, in, info, handler)}@@ -398,8 +398,8 @@ var SQLService_ServiceDesc = grpc.ServiceDesc{Handler: _SQLService_Query_Handler,},{- MethodName: "ListQueryHistories",- Handler: _SQLService_ListQueryHistories_Handler,+ MethodName: "SearchQueryHistories",+ Handler: _SQLService_SearchQueryHistories_Handler,},{MethodName: "Export",diff --git a/proto/store/query_history.proto b/proto/store/query_history.protonew file mode 100644index 0000000000..f77bc1125e--- /dev/null+++ b/proto/store/query_history.proto@@ -0,0 +1,12 @@+syntax = "proto3";++package bytebase.store;++import "google/protobuf/duration.proto";++option go_package = "generated-go/store";++message QueryHistoryPayload {+ optional string error = 1;+ google.protobuf.Duration duration = 2;+}diff --git a/proto/v1/sql_service.proto b/proto/v1/sql_service.protoindex 20a82d2f1c..7d0a18948e 100644--- a/proto/v1/sql_service.proto+++ b/proto/v1/sql_service.proto@@ -20,8 +20,8 @@ service SQLService {body: "*"};}- rpc ListQueryHistories(ListQueryHistoriesRequest) returns (ListQueryHistoriesResponse) {- option (google.api.http) = {get: "/v1/queryHistories"};+ rpc SearchQueryHistories(SearchQueryHistoriesRequest) returns (SearchQueryHistoriesResponse) {+ option (google.api.http) = {get: "/v1/queryHistories:search"};}rpc Export(ExportRequest) returns (ExportResponse) {option (google.api.http) = {@@ -303,7 +303,7 @@ message StringifyMetadataResponse {string schema = 1 [(google.api.field_behavior) = OUTPUT_ONLY];}-message ListQueryHistoriesRequest {+message SearchQueryHistoriesRequest {// Not used. The maximum number of histories to return.// The service may return fewer than this value.// If unspecified, at most 100 history entries will be returned.@@ -316,13 +316,17 @@ message ListQueryHistoriesRequest {// filter is the filter to apply on the search query history,// follow the [ebnf](https://en.wikipedia.org/wiki/Extended_Backus%E2%80%93Naur_form) syntax.- // Only support filter by database for now.- // For example:- // database = "instances/{instance}/databases/{database}"+ // Support filter by:+ // - database, for example:+ // database = "instances/{instance}/databases/{database}"+ // - instance, for example:+ // instance = "instance/{instance}"+ // - type, for example:+ // type = "QUERY"string filter = 3;}-message ListQueryHistoriesResponse {+message SearchQueryHistoriesResponse {// The list of history.repeated QueryHistory query_histories = 1 [(google.api.field_behavior) = OUTPUT_ONLY];@@ -350,4 +354,12 @@ message QueryHistory {optional string error = 6 [(google.api.field_behavior) = OUTPUT_ONLY];google.protobuf.Duration duration = 7 [(google.api.field_behavior) = OUTPUT_ONLY];++ enum Type {+ TYPE_UNSPECIFIED = 0;+ QUERY = 1;+ EXPORT = 2;+ }++ Type type = 8;}