修改为sql数据库

This commit is contained in:
bjdgyc
2021-07-15 18:17:37 +08:00
parent 6daf9cbfa3
commit 884f41d2f8
19 changed files with 351 additions and 175 deletions

View File

@@ -11,12 +11,13 @@ import (
func preIpData() {
tmpDb := path.Join(os.TempDir(), "anylink_test.db")
base.Cfg.DbFile = tmpDb
base.Cfg.DbType = "sqlite3"
base.Cfg.DbDsn = tmpDb
initDb()
}
func closeIpdata() {
sdb.Close()
xdb.Close()
tmpDb := path.Join(os.TempDir(), "anylink_test.db")
os.Remove(tmpDb)
}
@@ -27,7 +28,7 @@ func TestDb(t *testing.T) {
defer closeIpdata()
u := User{Username: "a"}
err := Save(&u)
err := Add(&u)
ast.Nil(err)
ast.Equal(u.Id, 1)