MCPcopy
hub / github.com/jmoiron/sqlx / asSliceForIn

Function asSliceForIn

bind.go:117–137  ·  view source on GitHub ↗
(i interface{})

Source from the content-addressed store, hash-verified

115}
116
117func 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

Callers 1

InFunction · 0.85

Calls 2

DerefFunction · 0.92
KindMethod · 0.80

Tested by

no test coverage detected