Skip to content

Commit 171c0ba

Browse files
committed
Call reflectx.Deref directly to avoid allocating an error.
1 parent 7400168 commit 171c0ba

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

bind.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ import (
66
"reflect"
77
"strconv"
88
"strings"
9+
10+
"github.com/jmoiron/sqlx/reflectx"
911
)
1012

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

108110
for i, arg := range args {
109111
v := reflect.ValueOf(arg)
110-
t, _ := baseType(v.Type(), reflect.Slice)
112+
t := reflectx.Deref(v.Type())
111113

112-
if t != nil {
114+
if t.Kind() == reflect.Slice {
113115
meta[i].length = v.Len()
114116
meta[i].v = v
115117

0 commit comments

Comments
 (0)