diff options
Diffstat (limited to '')
-rw-r--r-- | pkg/reader/db.go (renamed from pkg/db/setup.go) | 5 | ||||
-rw-r--r-- | pkg/reader/db_test.go (renamed from pkg/db/setup_test.go) | 8 | ||||
-rw-r--r-- | pkg/reader/testdata/test.db | bin | 0 -> 135168 bytes |
3 files changed, 5 insertions, 8 deletions
diff --git a/pkg/db/setup.go b/pkg/reader/db.go index d274c19..6f62de1 100644 --- a/pkg/db/setup.go +++ b/pkg/reader/db.go @@ -1,4 +1,4 @@ -package db +package reader import ( "database/sql" @@ -9,7 +9,6 @@ import ( "time" _ "github.com/mattn/go-sqlite3" - "github.com/yulqen/datamaps-go/pkg/reader" ) func SetupDB(path string) (*sql.DB, error) { @@ -53,7 +52,7 @@ func SetupDB(path string) (*sql.DB, error) { // TODO - how do we avoid passing in all these params!??! //DatamapToDB takes a slice of DatamapLine and writes it to a sqlite3 db file. -func DatamapToDB(d_path string, data []reader.DatamapLine, dm_name string, dm_path string) error { +func DatamapToDB(d_path string, data []DatamapLine, dm_name string, dm_path string) error { fmt.Printf("Importing datamap file %s and naming it %s.\n", dm_path, dm_name) // db, err := SetupDB("/home/lemon/.config/datamaps-go/datamaps.db") // if err != nil { diff --git a/pkg/db/setup_test.go b/pkg/reader/db_test.go index b3231fc..5c33343 100644 --- a/pkg/db/setup_test.go +++ b/pkg/reader/db_test.go @@ -1,9 +1,7 @@ -package db +package reader import ( "testing" - - "github.com/yulqen/datamaps-go/pkg/reader" ) func TestOpenSQLiteFile(t *testing.T) { @@ -32,11 +30,11 @@ func TestOpenSQLiteFile(t *testing.T) { } func TestDatamapGoesIntoDB(t *testing.T) { - d, err := reader.ReadDML("./testdata/datamap.csv") + d, err := ReadDML("./testdata/datamap.csv") if err != nil { t.Fatal(err) } - err = DatamapToDB(d, "First Datamap", "./testdata/test.db") + err = DatamapToDB("./testdata/test.db", d, "First Datamap", "./testdata/test.db") if err != nil { t.Errorf("Unable to write datamap to database file because %v.", err) } diff --git a/pkg/reader/testdata/test.db b/pkg/reader/testdata/test.db Binary files differnew file mode 100644 index 0000000..bbdc08f --- /dev/null +++ b/pkg/reader/testdata/test.db |