aboutsummaryrefslogtreecommitdiff
path: root/vendor/github.com/go-xorm/builder
diff options
context:
space:
mode:
authorUnknwon <u@gogs.io>2017-02-18 11:22:44 -0500
committerUnknwon <u@gogs.io>2017-02-18 11:22:44 -0500
commitdbd9f05c066a097dad206c394e785bb30d176fe4 (patch)
tree0e37784031c36882aea798de336fa203bb75644c /vendor/github.com/go-xorm/builder
parent77757f6d39e2c8af3f13405bc1500dc9c03813fd (diff)
vendor: update github.com/go-xorm/*
Diffstat (limited to 'vendor/github.com/go-xorm/builder')
-rw-r--r--vendor/github.com/go-xorm/builder/cond_in.go24
1 files changed, 20 insertions, 4 deletions
diff --git a/vendor/github.com/go-xorm/builder/cond_in.go b/vendor/github.com/go-xorm/builder/cond_in.go
index 9ada13b7..692d2e28 100644
--- a/vendor/github.com/go-xorm/builder/cond_in.go
+++ b/vendor/github.com/go-xorm/builder/cond_in.go
@@ -6,6 +6,7 @@ package builder
import (
"fmt"
+ "reflect"
"strings"
)
@@ -195,11 +196,26 @@ func (condIn condIn) WriteTo(w Writer) error {
if len(condIn.vals) <= 0 {
return ErrNoInConditions
}
- questionMark := strings.Repeat("?,", len(condIn.vals))
- if _, err := fmt.Fprintf(w, "%s IN (%s)", condIn.col, questionMark[:len(questionMark)-1]); err != nil {
- return err
+
+ v := reflect.ValueOf(condIn.vals[0])
+ if v.Kind() == reflect.Slice {
+ l := v.Len()
+
+ questionMark := strings.Repeat("?,", l)
+ if _, err := fmt.Fprintf(w, "%s IN (%s)", condIn.col, questionMark[:len(questionMark)-1]); err != nil {
+ return err
+ }
+
+ for i := 0; i < l; i++ {
+ w.Append(v.Index(i).Interface())
+ }
+ } else {
+ questionMark := strings.Repeat("?,", len(condIn.vals))
+ if _, err := fmt.Fprintf(w, "%s IN (%s)", condIn.col, questionMark[:len(questionMark)-1]); err != nil {
+ return err
+ }
+ w.Append(condIn.vals...)
}
- w.Append(condIn.vals...)
}
return nil
}