From a9ce16bfc61c68e3c36f88dced00fb1abe4f563c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Matczuk?= Date: Thu, 16 Apr 2020 12:55:31 +0200 Subject: [PATCH] iterx: Refactor DefaultUnsafe handling MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Assign unsafe from DefaultUnsafe and simplify condition. Signed-off-by: MichaƂ Matczuk --- iterx.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/iterx.go b/iterx.go index 0155c41..5e29eb5 100644 --- a/iterx.go +++ b/iterx.go @@ -36,6 +36,7 @@ func Iter(q *gocql.Query) *Iterx { return &Iterx{ Iter: q.Iter(), Mapper: DefaultMapper, + unsafe: DefaultUnsafe, } } @@ -215,7 +216,7 @@ func (iter *Iterx) StructScan(dest interface{}) bool { iter.fields = m.TraversalsByName(v.Type(), columns) // if we are not unsafe and are missing fields, return an error - if !iter.unsafe && !DefaultUnsafe { + if !iter.unsafe { if f, err := missingFields(iter.fields); err != nil { iter.err = fmt.Errorf("missing destination name %q in %T", columns[f], dest) return false