diff options
author | Lunny Xiao <xiaolunwen@gmail.com> | 2017-02-16 12:07:00 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-02-16 12:07:00 +0800 |
commit | 46320f9630087e010a31ab580294cc9137eb865f (patch) | |
tree | 99997f1335e1f6ee2963045fb90462322e44f155 /vendor | |
parent | 0642cb330cbdb58632d6b7b5831200ff339bba8a (diff) | |
download | gitea-46320f9630087e010a31ab580294cc9137eb865f.tar.gz gitea-46320f9630087e010a31ab580294cc9137eb865f.zip |
refactor notificationsForUser since xorm In support slice of customerize type (#956)
Diffstat (limited to 'vendor')
-rw-r--r-- | vendor/github.com/go-xorm/builder/cond_in.go | 24 | ||||
-rw-r--r-- | vendor/vendor.json | 6 |
2 files changed, 23 insertions, 7 deletions
diff --git a/vendor/github.com/go-xorm/builder/cond_in.go b/vendor/github.com/go-xorm/builder/cond_in.go index 9ada13b700..692d2e289a 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 } diff --git a/vendor/vendor.json b/vendor/vendor.json index b255e005b9..f77de08d1f 100644 --- a/vendor/vendor.json +++ b/vendor/vendor.json @@ -437,10 +437,10 @@ "revisionTime": "2016-11-01T11:13:14Z" }, { - "checksumSHA1": "sDRC697KuCbpI+1i2VPhyqgAvjs=", + "checksumSHA1": "Fh6Svimt+QyXHbaVxgSV7qwUHL8=", "path": "github.com/go-xorm/builder", - "revision": "db75972580de4a7c6c20fff5b16a924c3de3fa12", - "revisionTime": "2016-12-14T02:05:24Z" + "revision": "9c357861b643b7dd1023551fdf116b8d42030146", + "revisionTime": "2017-02-16T03:03:40Z" }, { "checksumSHA1": "OCcksAYN5m0kc5yJF/Ba4VVHqeA=", |