MVP: 按 07 风格重写前端 + Go 后端落地(长文/短文、编辑器、后台管理)

This commit is contained in:
Sakurasan
2026-09-20 20:56:03 +08:00
parent edee708802
commit 4d8f2de3a4
96 changed files with 6005 additions and 2602 deletions
+28
View File
@@ -0,0 +1,28 @@
package db
import "testing"
func TestRebind(t *testing.T) {
sqlite := &DB{Dialect: SQLite}
pg := &DB{Dialect: Postgres}
q := "SELECT * FROM posts WHERE kind = ? AND status = ? LIMIT ? OFFSET ?"
if got := sqlite.Rebind(q); got != q {
t.Errorf("sqlite must keep ? placeholders, got %q", got)
}
want := "SELECT * FROM posts WHERE kind = $1 AND status = $2 LIMIT $3 OFFSET $4"
if got := pg.Rebind(q); got != want {
t.Errorf("postgres rebind:\n got %q\nwant %q", got, want)
}
}
func TestAutoInc(t *testing.T) {
if got := (&DB{Dialect: SQLite}).AutoInc(); got != "INTEGER PRIMARY KEY AUTOINCREMENT" {
t.Errorf("sqlite autoincrement = %q", got)
}
if got := (&DB{Dialect: Postgres}).AutoInc(); got != "BIGSERIAL PRIMARY KEY" {
t.Errorf("postgres autoincrement = %q", got)
}
}