From 49ad12f149dfd81c44adfa8a356051c26ce1fd8e Mon Sep 17 00:00:00 2001 From: Johan Sim Date: Wed, 12 Nov 2025 10:40:40 +0800 Subject: [PATCH] feat: Added support for MySQL. --- go.mod | 2 ++ pkg/workflow/db/sql.go | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/go.mod b/go.mod index 3b3bef80a..c3e358539 100644 --- a/go.mod +++ b/go.mod @@ -15,6 +15,7 @@ require ( github.com/docker/docker v25.0.6+incompatible github.com/evanphx/json-patch/v5 v5.9.0 github.com/fatih/color v1.17.0 + github.com/go-sql-driver/mysql v1.8.1 github.com/gocarina/gocsv v0.0.0-20220927221512-ad3251f9fa25 github.com/hashicorp/go-retryablehttp v0.7.7 github.com/hashicorp/go-version v1.6.0 @@ -54,6 +55,7 @@ require ( cel.dev/expr v0.23.0 // indirect contrib.go.opencensus.io/exporter/prometheus v0.4.2 // indirect dario.cat/mergo v1.0.1 // indirect + filippo.io/edwards25519 v1.1.0 // indirect github.com/AdaLogics/go-fuzz-headers v0.0.0-20230811130428-ced1acdcaa24 // indirect github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161 // indirect github.com/BurntSushi/toml v1.4.0 // indirect diff --git a/pkg/workflow/db/sql.go b/pkg/workflow/db/sql.go index fd1b30dcc..6f5012e6d 100644 --- a/pkg/workflow/db/sql.go +++ b/pkg/workflow/db/sql.go @@ -18,6 +18,7 @@ import ( "database/sql" "fmt" + _ "github.com/go-sql-driver/mysql" _ "github.com/jackc/pgx/v5/stdlib" _ "github.com/mattn/go-sqlite3" _ "github.com/microsoft/go-mssqldb" @@ -36,7 +37,7 @@ func SQL(ctx context.Context, driver, connString string) (*sql.DB, error) { } func ListSQL(ctx context.Context, db *sql.DB, table string, opts ListOptions) ([]string, error) { - query := fmt.Sprintf(`SELECT key FROM "%s" WHERE key LIKE ?;`, table) + query := fmt.Sprintf("SELECT `id` FROM `%s` WHERE `id` LIKE ?;", table) like := opts.AppID + "||dapr.internal." + opts.Namespace + "." + opts.AppID + ".workflow||%||metadata" rows, err := db.QueryContext(ctx, query, like)