@@ -4,6 +4,8 @@ import (
|
||||
"os"
|
||||
"testing"
|
||||
|
||||
simpleorm "git.gdulai.com/gdulai/simpleorm"
|
||||
"git.gdulai.com/gdulai/simpleorm/exec"
|
||||
_ "github.com/mattn/go-sqlite3"
|
||||
log "gitlab.com/gdulai/simpleloglvl"
|
||||
)
|
||||
@@ -61,3 +63,18 @@ func TestMain(m *testing.M) {
|
||||
|
||||
os.Exit(code)
|
||||
}
|
||||
|
||||
func testSetup() (*simpleorm.ORM, *simpleorm.DBConnection) {
|
||||
conn := simpleorm.OpenConnection("sqlite3", "file:test.db")
|
||||
|
||||
orm := simpleorm.NewORM(Test{}, TestWithFk{}, TestWithFkAndFkId{},
|
||||
TestWithCompositePk{}, TestWithCompositeFk{}, TestWithBool{}, TestWithTime{})
|
||||
exec.ExecuteDDL(conn, orm)
|
||||
|
||||
return orm, conn
|
||||
}
|
||||
|
||||
func cleanUp(dbFile string, conn *simpleorm.DBConnection) {
|
||||
conn.Close()
|
||||
os.Remove(dbFile)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user