fixed issue with null values in where conditions

This commit is contained in:
Viktor Nikolaiev 2017-10-03 17:17:39 +03:00 committed by Jinzhu
parent fce49136e8
commit ba3e6201c7
1 changed files with 3 additions and 3 deletions

View File

@ -563,7 +563,7 @@ func (scope *Scope) buildWhereCondition(clause map[string]interface{}) (str stri
var err error var err error
//non byte slice and non driver.Valuer //non byte slice and non driver.Valuer
if rArgType.Kind() == reflect.Slice && rArgType.Elem().Kind() != reflect.Uint8 && !isValuer { if arg != nil && rArgType.Kind() == reflect.Slice && rArgType.Elem().Kind() != reflect.Uint8 && !isValuer {
if rArg.Len() > 0 { if rArg.Len() > 0 {
tempMarks := make([]string, 0, rArg.Len()) tempMarks := make([]string, 0, rArg.Len())
for i := 0; i < rArg.Len(); i++ { for i := 0; i < rArg.Len(); i++ {
@ -642,7 +642,7 @@ func (scope *Scope) buildNotCondition(clause map[string]interface{}) (str string
var err error var err error
//non byte slice and non driver.Valuer //non byte slice and non driver.Valuer
if rArgType.Kind() == reflect.Slice && rArgType.Elem().Kind() != reflect.Uint8 && !isValuer { if arg != nil && rArgType.Kind() == reflect.Slice && rArgType.Elem().Kind() != reflect.Uint8 && !isValuer {
if rArg.Len() > 0 { if rArg.Len() > 0 {
tempMarks := make([]string, 0, rArg.Len()) tempMarks := make([]string, 0, rArg.Len())
for i := 0; i < rArg.Len(); i++ { for i := 0; i < rArg.Len(); i++ {
@ -683,7 +683,7 @@ func (scope *Scope) buildSelectQuery(clause map[string]interface{}) (str string)
var err error var err error
//non byte slice and non driver.Valuer //non byte slice and non driver.Valuer
if rArgType.Kind() == reflect.Slice && rArgType.Elem().Kind() != reflect.Uint8 && !isValuer { if arg != nil && rArgType.Kind() == reflect.Slice && rArgType.Elem().Kind() != reflect.Uint8 && !isValuer {
if rArg.Len() > 0 { if rArg.Len() > 0 {
tempMarks := make([]string, 0, rArg.Len()) tempMarks := make([]string, 0, rArg.Len())
for i := 0; i < rArg.Len(); i++ { for i := 0; i < rArg.Len(); i++ {