diff options
author | Matthew Lemon <matt@matthewlemon.com> | 2020-07-26 19:48:58 +0100 |
---|---|---|
committer | Matthew Lemon <matt@matthewlemon.com> | 2020-07-26 19:48:58 +0100 |
commit | 474763178383049f882139d7cc352477906727c9 (patch) | |
tree | 73d92eb4543687c4bcff5bcf0d063784c3a541a4 /pkg/datamaps/reader.go | |
parent | fe186c2865c9a54cfb488f14fb6142257d712b94 (diff) |
added an error to return for func
Diffstat (limited to 'pkg/datamaps/reader.go')
-rw-r--r-- | pkg/datamaps/reader.go | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/pkg/datamaps/reader.go b/pkg/datamaps/reader.go index 61771c0..bb4cad7 100644 --- a/pkg/datamaps/reader.go +++ b/pkg/datamaps/reader.go @@ -181,12 +181,14 @@ func DMLFromDB(name string, db *sql.DB) ([]DatamapLine, error) { return out, nil } -func ExtractDBDM(name string, file string, db *sql.DB) ExtractedData { +// ExtractDBDM uses a datamap named from the database db to extract values +// from the populated spreadsheet file file. +func ExtractDBDM(name string, file string, db *sql.DB) (ExtractedData, error) { xdata := ReadXLSX(file) ddata, err := DMLFromDB(name, db) // this will need to return a []DatamapLine if err != nil { - log.Fatal(err) + return nil, err } names := getSheetNames(ddata) @@ -203,7 +205,7 @@ func ExtractDBDM(name string, file string, db *sql.DB) ExtractedData { } } - return outer + return outer, nil } //Extract returns the file's data as a map, |