wip: storage using postgres / gorm using partial json
Several approaches of normalizing json were tried and ultimately found impractical at this point. Using a hybrid of tables and json is the current approach; this may be further normalized later.
This commit is contained in:
committed by
=Michael Hohn
parent
593644ca2e
commit
25cab583c1
29
test/storage_json_test.go
Normal file
29
test/storage_json_test.go
Normal file
@@ -0,0 +1,29 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"mrvacommander/pkg/storage"
|
||||
)
|
||||
|
||||
func TestSetupDB(t *testing.T) {
|
||||
|
||||
db, err := storage.ConnectDB(storage.DBSpec{
|
||||
Host: "localhost",
|
||||
Port: 5432,
|
||||
User: "exampleuser",
|
||||
Password: "examplepass",
|
||||
DBname: "exampledb",
|
||||
})
|
||||
|
||||
if err != nil {
|
||||
t.Errorf("Cannot connect to db")
|
||||
}
|
||||
|
||||
// Check and set up the database
|
||||
s := storage.StorageContainer{RequestID: 12345, DB: db}
|
||||
if err := s.SetupDB(); err != nil {
|
||||
t.Errorf("Cannot set up db")
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user