Skip to content

Commit

Permalink
Call reflectx.Deref directly to avoid allocating an error.
Browse files Browse the repository at this point in the history
  • Loading branch information
nussjustin committed Aug 8, 2015
1 parent 7400168 commit 171c0ba
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions bind.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import (
"reflect"
"strconv"
"strings"

"github.com/jmoiron/sqlx/reflectx"
)

// Bindvar types supported by Rebind, BindMap and BindStruct.
Expand Down Expand Up @@ -107,9 +109,9 @@ func In(query string, args ...interface{}) (string, []interface{}, error) {

for i, arg := range args {
v := reflect.ValueOf(arg)
t, _ := baseType(v.Type(), reflect.Slice)
t := reflectx.Deref(v.Type())

if t != nil {
if t.Kind() == reflect.Slice {
meta[i].length = v.Len()
meta[i].v = v

Expand Down

0 comments on commit 171c0ba

Please sign in to comment.