feat: OpsxDB 桌面数据库客户端首版入库
含工作台/连库多引擎字段与 SSH·SSL、结果编辑、Redis 键浏览、 Tauri 桌面与 docs/落地页;排除本地构建产物与 sidecar 二进制。
This commit is contained in:
commit
f8740d27f7
240 files changed
+21625
No files matched your search
@@ -0,0 +1,39 @@
|
||||
package db
|
||||
|
||||
import (
|
||||
"context"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestIsQuerySQL(t *testing.T) {
|
||||
if !isQuerySQL("SELECT 1") {
|
||||
t.Fatal("select")
|
||||
}
|
||||
if isQuerySQL("DELETE FROM t") {
|
||||
t.Fatal("delete is not query")
|
||||
}
|
||||
if !isQuerySQL("-- hi\nSELECT 1") {
|
||||
t.Fatal("comment then select")
|
||||
}
|
||||
}
|
||||
|
||||
func TestIsDangerousSQL(t *testing.T) {
|
||||
if !IsDangerousSQL("DROP TABLE users") {
|
||||
t.Fatal("drop")
|
||||
}
|
||||
if !IsDangerousSQL("DELETE FROM users") {
|
||||
t.Fatal("delete no where")
|
||||
}
|
||||
if IsDangerousSQL("DELETE FROM users WHERE id=1") {
|
||||
t.Fatal("delete with where is ok")
|
||||
}
|
||||
if IsDangerousSQL("SELECT * FROM users") {
|
||||
t.Fatal("select")
|
||||
}
|
||||
}
|
||||
|
||||
func TestErrMsgCanceled(t *testing.T) {
|
||||
if got := errMsg(context.Canceled); got != "已取消" {
|
||||
t.Fatalf("got %q", got)
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user