Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

refactor: rename resultSet.result to resultSet.data (#252)

tianzhoubaec8365b6a3
diff --git a/api/sql.go b/api/sql.go
index cca9a40796..1f6f370ab8 100644
--- a/api/sql.go
+++ b/api/sql.go
@@ -39,7 +39,7 @@ type SQLExecute struct {
// SQLResultSet is the API message for SQL results.
type SQLResultSet struct {
// A list of rows marshalled into a JSON.
- Result string `jsonapi:"attr,result"`
+ Data string `jsonapi:"attr,data"`
// SQL operation may fail for connection issue and there is no proper http status code for it, so we return error in the response body.
Error string `jsonapi:"attr,error"`
}
diff --git a/frontend/src/store/modules/sql.ts b/frontend/src/store/modules/sql.ts
index bcfd26a60c..ff32a0e2b6 100644
--- a/frontend/src/store/modules/sql.ts
+++ b/frontend/src/store/modules/sql.ts
@@ -10,7 +10,7 @@ import {
function convert(resultSet: ResourceObject): SqlResultSet {
return {
- result: JSON.parse((resultSet.attributes.result as string) || "{}"),
+ data: JSON.parse((resultSet.attributes.data as string) || "{}"),
error: resultSet.attributes.error as string,
};
}
diff --git a/frontend/src/types/sql.ts b/frontend/src/types/sql.ts
index b46cf82848..9f051e71fb 100644
--- a/frontend/src/types/sql.ts
+++ b/frontend/src/types/sql.ts
@@ -24,6 +24,6 @@ export type QueryInfo = {
}
export type SqlResultSet = {
- result: string;
+ data: string;
error: string;
};
diff --git a/server/sql.go b/server/sql.go
index 7eb28e0135..5c10e81d6c 100644
--- a/server/sql.go
+++ b/server/sql.go
@@ -135,10 +135,10 @@ func (s *Server) registerSQLRoutes(g *echo.Group) {
resultSet := &api.SQLResultSet{}
if err == nil {
- resultSet.Result = string(bytes)
+ resultSet.Data = string(bytes)
s.l.Debug("Query result",
zap.String("statement", exec.Statement),
- zap.String("result", resultSet.Result),
+ zap.String("data", resultSet.Data),
)
} else {
resultSet.Error = err.Error()