mirror of
https://gitee.com/dromara/mayfly-go
synced 2025-11-15 05:40:25 +08:00
feat: i18n
This commit is contained in:
28
server/pkg/base/sql_test.go
Normal file
28
server/pkg/base/sql_test.go
Normal file
@@ -0,0 +1,28 @@
|
||||
package base
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestParserSql(t *testing.T) {
|
||||
sql := `-- selectByCond
|
||||
Select * from tdb where id > 10;
|
||||
-- another comment
|
||||
Select * from another_table where name = 'test'
|
||||
and age = ?;
|
||||
-- multi-line comment
|
||||
-- continues here
|
||||
Select * from yet_another_table
|
||||
Where id = ?;`
|
||||
|
||||
statements, err := parseSQL(sql)
|
||||
if err != nil {
|
||||
fmt.Println("Error:", err)
|
||||
return
|
||||
}
|
||||
|
||||
for _, stmt := range statements {
|
||||
fmt.Printf("Comment: %s\nSQL: %s\n\n", stmt.Comment, stmt.SQL)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user