Skip to content

Commit

Permalink
Fix the structure binding
Browse files Browse the repository at this point in the history
  • Loading branch information
leporo committed Oct 2, 2021
1 parent 4259482 commit b8e0a96
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion stmt.go
Original file line number Diff line number Diff line change
Expand Up @@ -645,7 +645,9 @@ func (q *Stmt) Bind(data interface{}) *Stmt {
for i := 0; i < val.NumField(); i++ {
field := val.Field(i)
dbFieldName := typ.Field(i).Tag.Get("db")
q.Select(dbFieldName).To(field.Addr().Interface())
if dbFieldName != "" {
q.Select(dbFieldName).To(field.Addr().Interface())
}
}
return q
}
Expand Down

0 comments on commit b8e0a96

Please sign in to comment.