feature: 执行 SQL 脚本时显示执行进度

This commit is contained in:
kanzihuang
2023-10-15 10:36:01 +08:00
committed by wanli
parent a64b894b08
commit 361eafedae
5 changed files with 36 additions and 17 deletions

View File

@@ -1,14 +1,12 @@
package entity
import (
"testing"
"github.com/stretchr/testify/require"
"testing"
)
func Test_escapeSql(t *testing.T) {
func Test_QuoteLiteral(t *testing.T) {
tests := []struct {
name string
dbType DbType
sql string
want string
@@ -24,7 +22,6 @@ func Test_escapeSql(t *testing.T) {
want: "'''a'''",
},
{
name: "不间断空格",
dbType: DbTypeMysql,
sql: "a\u00A0b",
want: "'a\u00A0b'",
@@ -40,14 +37,13 @@ func Test_escapeSql(t *testing.T) {
want: "'''a'''",
},
{
name: "不间断空格",
dbType: DbTypePostgres,
sql: "a\u00A0b",
want: "'a\u00A0b'",
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
t.Run(string(tt.dbType)+"_"+tt.sql, func(t *testing.T) {
got := tt.dbType.QuoteLiteral(tt.sql)
require.Equal(t, tt.want, got)
})