Skip to content

Commit

Permalink
skip unexported fields to prevent panic
Browse files Browse the repository at this point in the history
  • Loading branch information
James authored and James committed Jun 18, 2023
1 parent c48ea36 commit a5ea8ed
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions sqlez.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,11 @@ func (s *DB) scanStruct(v reflect.Value, pointers bool, skipEmpty bool, firstRun
_, skiptagexists := fieldt.Tag.Lookup(s.dbskipTag)
skip := (skipEmpty && (field.Interface() == reflect.Zero(field.Type()).Interface()))

// Ignore all unexported or skipped fields
if (!jsonexists && !dbexists) || skiptagexists {
continue
}

if label == "" && dblabel != "" {
label = dblabel
}
Expand Down

0 comments on commit a5ea8ed

Please sign in to comment.