mirror of
https://github.com/dolthub/dolt.git
synced 2026-01-07 00:39:44 -06:00
/go/cmd/dolt/commands/ci/dolt_test_step_view.go: add comment for makePreviewStatements
This commit is contained in:
@@ -15,11 +15,11 @@
|
||||
package ci
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
"github.com/dolthub/dolt/go/libraries/doltcore/env/actions/dolt_ci"
|
||||
dtablefunctions "github.com/dolthub/dolt/go/libraries/doltcore/sqle/dtablefunctions"
|
||||
"github.com/dolthub/dolt/go/libraries/doltcore/env/actions/dolt_ci"
|
||||
dtablefunctions "github.com/dolthub/dolt/go/libraries/doltcore/sqle/dtablefunctions"
|
||||
)
|
||||
|
||||
// previewDoltTestStatements returns the SQL queries that would be executed by dolt_test_run
|
||||
@@ -68,12 +68,17 @@ func buildPreviewSelectors(dt *dolt_ci.DoltTestStep) []string {
|
||||
return []string{"*"}
|
||||
}
|
||||
|
||||
// makePreviewStatements constructs human-readable SQL statements that illustrate how
|
||||
// dolt_test_run would be invoked for each selector. These are for preview output only
|
||||
// (e.g., `dolt ci view`) and are not executed. We intentionally return the final
|
||||
// interpolated strings to make the preview easy to read.
|
||||
func makePreviewStatements(selectors []string) []string {
|
||||
fn := (&dtablefunctions.TestsRunTableFunction{}).Name()
|
||||
stmts := make([]string, 0, len(selectors))
|
||||
for _, s := range selectors {
|
||||
esc := strings.ReplaceAll(s, "'", "''")
|
||||
stmts = append(stmts, fmt.Sprintf("SELECT * FROM %s('%s')", fn, esc))
|
||||
}
|
||||
return stmts
|
||||
fn := (&dtablefunctions.TestsRunTableFunction{}).Name()
|
||||
stmts := make([]string, 0, len(selectors))
|
||||
for _, s := range selectors {
|
||||
// Escape single quotes for display; this is a preview string, not executed SQL.
|
||||
esc := strings.ReplaceAll(s, "'", "''")
|
||||
stmts = append(stmts, fmt.Sprintf("SELECT * FROM %s('%s')", fn, esc))
|
||||
}
|
||||
return stmts
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user