fix(mysql): fix mysql tool kind to mysql-sql (#248)

Update `mysql` tool to `mysql-sql`.
This commit is contained in:
Yuan
2025-01-29 15:09:13 -08:00
committed by GitHub
parent b0ecc16a43
commit 669d6b7239
3 changed files with 10 additions and 10 deletions

View File

@@ -30,7 +30,7 @@ import (
spannersrc "github.com/googleapis/genai-toolbox/internal/sources/spanner"
"github.com/googleapis/genai-toolbox/internal/tools"
"github.com/googleapis/genai-toolbox/internal/tools/mssql"
"github.com/googleapis/genai-toolbox/internal/tools/mysql"
"github.com/googleapis/genai-toolbox/internal/tools/mysqlsql"
neo4jtool "github.com/googleapis/genai-toolbox/internal/tools/neo4j"
"github.com/googleapis/genai-toolbox/internal/tools/postgressql"
"github.com/googleapis/genai-toolbox/internal/tools/spanner"
@@ -254,8 +254,8 @@ func (c *ToolConfigs) UnmarshalYAML(unmarshal func(interface{}) error) error {
return fmt.Errorf("unable to parse as %q: %w", k.Kind, err)
}
(*c)[name] = actual
case mysql.ToolKind:
actual := mysql.Config{Name: name}
case mysqlsql.ToolKind:
actual := mysqlsql.Config{Name: name}
if err := u.Unmarshal(&actual); err != nil {
return fmt.Errorf("unable to parse as %q: %w", k.Kind, err)
}

View File

@@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
package mysql
package mysqlsql
import (
"context"
@@ -25,7 +25,7 @@ import (
"github.com/googleapis/genai-toolbox/internal/tools"
)
const ToolKind string = "mysql"
const ToolKind string = "mysql-sql"
type compatibleSource interface {
MySQLPool() *sql.DB

View File

@@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
package mysql_test
package mysqlsql_test
import (
"testing"
@@ -21,7 +21,7 @@ import (
"github.com/googleapis/genai-toolbox/internal/server"
"github.com/googleapis/genai-toolbox/internal/testutils"
"github.com/googleapis/genai-toolbox/internal/tools"
"github.com/googleapis/genai-toolbox/internal/tools/mysql"
"github.com/googleapis/genai-toolbox/internal/tools/mysqlsql"
"gopkg.in/yaml.v3"
)
@@ -36,7 +36,7 @@ func TestParseFromYamlMySQL(t *testing.T) {
in: `
tools:
example_tool:
kind: mysql
kind: mysql-sql
source: my-mysql-instance
description: some description
statement: |
@@ -55,9 +55,9 @@ func TestParseFromYamlMySQL(t *testing.T) {
field: user_id
`,
want: server.ToolConfigs{
"example_tool": mysql.Config{
"example_tool": mysqlsql.Config{
Name: "example_tool",
Kind: mysql.ToolKind,
Kind: mysqlsql.ToolKind,
Source: "my-mysql-instance",
Description: "some description",
Statement: "SELECT * FROM SQL_STATEMENT;\n",