Skip to content

Commit 364f96a

Browse files
committed
Added comment and test
1 parent f9cd482 commit 364f96a

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

bind.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ func In(query string, args ...interface{}) (string, []interface{}, error) {
113113
v := reflect.ValueOf(arg)
114114
t := reflectx.Deref(v.Type())
115115

116+
// []byte is a driver.Value type so it should not be expanded
116117
if t.Kind() == reflect.Slice && t != reflect.TypeOf([]byte{}) {
117118
meta[i].length = v.Len()
118119
meta[i].v = v

sqlx_test.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1490,6 +1490,9 @@ func TestIn(t *testing.T) {
14901490
{"SELECT * FROM foo WHERE x in (?)",
14911491
[]interface{}{[]int{1, 2, 3, 4, 5, 6, 7, 8}},
14921492
8},
1493+
{"SELECT * FROM foo WHERE x = ? AND y in (?)",
1494+
[]interface{}{[]byte("foo"), []int{0, 5, 3}},
1495+
4},
14931496
}
14941497
for _, test := range tests {
14951498
q, a, err := In(test.q, test.args...)

0 commit comments

Comments
 (0)