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:
Michael Hohn
2024-06-06 13:19:00 -07:00
committed by =Michael Hohn
parent 593644ca2e
commit 25cab583c1
12 changed files with 88 additions and 246 deletions

View File

View File

View File

View File

29
test/storage_json_test.go Normal file
View 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")
}
}

View File