diff options
Diffstat (limited to 'pkg/datamaps')
-rw-r--r-- | pkg/datamaps/reader.go | 13 | ||||
-rw-r--r-- | pkg/datamaps/reader_test.go | 4 |
2 files changed, 5 insertions, 12 deletions
diff --git a/pkg/datamaps/reader.go b/pkg/datamaps/reader.go index 4490d23..1b9a471 100644 --- a/pkg/datamaps/reader.go +++ b/pkg/datamaps/reader.go @@ -200,21 +200,18 @@ func ExtractDBDatamap(name string, file string, db *sql.DB) (extractedData, erro names := getSheetNames(ddata) outer := make(extractedData, len(names)) - var inner map[string]xlsx.Cell + // var inner map[string]xlsx.Cell - seen := make(map[string]bool) // using this as a set to distinguish sheet names + for _, s := range names { + outer[s] = make(map[string]xlsx.Cell) + } for _, i := range ddata { sheet := i.Sheet - if !seen[sheet] { - seen[sheet] = true - inner = make(map[string]xlsx.Cell) // we create a new inner when we get a new sheet - } cellref := i.Cellref if val, ok := xdata[sheet][cellref]; ok { - inner[cellref] = *val.Cell - outer[sheet] = inner + outer[sheet][cellref] = *val.Cell } } diff --git a/pkg/datamaps/reader_test.go b/pkg/datamaps/reader_test.go index f784834..1a11b0d 100644 --- a/pkg/datamaps/reader_test.go +++ b/pkg/datamaps/reader_test.go @@ -187,10 +187,6 @@ func TestExtractUsingDBDM(t *testing.T) { d[c.sheet][c.cellref].Value) } } - - if d["Another Sheet"]["E26"].Value != "Integer:" { - t.Errorf("Expected E26 in Another Sheet sheet to be Integer: - instead it is %s", d["Another Sheet"]["E26"].Value) - } } func TestExtract(t *testing.T) { |