Initial commit: archer, a Go-native MySQL/MariaDB table archiver
Renamed from arcdb: module path, cmd/archer, internal/archererr, docs, build scripts and ARCHER_* environment variables. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
commit
bc4a6b504f
99 files changed
+12752
No files matched your search
@@ -0,0 +1,36 @@
|
||||
package sqlutil
|
||||
|
||||
import "testing"
|
||||
|
||||
func TestIdentQuoting(t *testing.T) {
|
||||
if got := Ident("a`b"); got != "`a``b`" {
|
||||
t.Fatalf("got %s", got)
|
||||
}
|
||||
if got := Qualified("db", "t"); got != "`db`.`t`" {
|
||||
t.Fatalf("got %s", got)
|
||||
}
|
||||
if got := Qualified("", "t"); got != "`t`" {
|
||||
t.Fatalf("got %s", got)
|
||||
}
|
||||
}
|
||||
|
||||
func TestGreaterThan(t *testing.T) {
|
||||
if got := GreaterThan([]string{"id"}); got != "`id` > ?" {
|
||||
t.Fatalf("got %s", got)
|
||||
}
|
||||
if got := GreaterThan([]string{"a", "b"}); got != "(`a`, `b`) > (?, ?)" {
|
||||
t.Fatalf("got %s", got)
|
||||
}
|
||||
}
|
||||
|
||||
func TestInList(t *testing.T) {
|
||||
if got := InList([]string{"id"}, 3); got != "`id` IN (?, ?, ?)" {
|
||||
t.Fatalf("got %s", got)
|
||||
}
|
||||
if got := InList([]string{"a", "b"}, 2); got != "(`a`, `b`) IN ((?, ?), (?, ?))" {
|
||||
t.Fatalf("got %s", got)
|
||||
}
|
||||
if got := InList([]string{"id"}, 0); got != "1=0" {
|
||||
t.Fatalf("got %s", got)
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user