From 7ec55c6c6c0d14fd290b499c942dbdfd38e8629d Mon Sep 17 00:00:00 2001 From: Fritz Larco Date: Fri, 25 Aug 2023 07:12:17 -0300 Subject: [PATCH] StringRecords keeps nil values [no test] --- iop/dataset.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/iop/dataset.go b/iop/dataset.go index fbb3af0..ee42eec 100644 --- a/iop/dataset.go +++ b/iop/dataset.go @@ -342,7 +342,11 @@ func (data *Dataset) StringRecords(lower ...bool) []map[string]interface{} { for i, row := range data.Rows { rec := map[string]interface{}{} for j, field := range data.GetFields(Lower) { - rec[field] = cast.ToString(row[j]) + if row[j] == nil { + rec[field] = nil + } else { + rec[field] = cast.ToString(row[j]) + } } records[i] = rec }