| 115 | } |
| 116 | |
| 117 | func asSliceForIn(i interface{}) (v reflect.Value, ok bool) { |
| 118 | if i == nil { |
| 119 | return reflect.Value{}, false |
| 120 | } |
| 121 | |
| 122 | v = reflect.ValueOf(i) |
| 123 | t := reflectx.Deref(v.Type()) |
| 124 | |
| 125 | // Only expand slices |
| 126 | if t.Kind() != reflect.Slice { |
| 127 | return reflect.Value{}, false |
| 128 | } |
| 129 | |
| 130 | // []byte is a driver.Value type so it should not be expanded |
| 131 | if t == reflect.TypeOf([]byte{}) { |
| 132 | return reflect.Value{}, false |
| 133 | |
| 134 | } |
| 135 | |
| 136 | return v, true |
| 137 | } |
| 138 | |
| 139 | // In expands slice values in args, returning the modified query string |
| 140 | // and a new arg list that can be executed by a database. The `query` should |