From 4b37804b01a0ae505955ed977dfc96647d155168 Mon Sep 17 00:00:00 2001 From: hoteas Date: Sun, 3 Dec 2017 18:38:03 +0000 Subject: [PATCH] --- db.go | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/db.go b/db.go index 95b60e2..fecf39e 100644 --- a/db.go +++ b/db.go @@ -628,14 +628,19 @@ func (this *HoTimeDB) varCond(k string, v interface{}) (string, []interface{}) { if reflect.ValueOf(v).Type().String() == "hotime.Slice" { where += "`" + k + "` IN (" res = append(res, (v.(Slice))...) - for i := 0; i < len(v.(Slice)); i++ { - if i+1 != len(v.(Slice)) { - where += "?," - } else { - where += "?) " + if len(v.(Slice))==0{ + where+=") " + }else{ + for i := 0; i < len(v.(Slice)); i++ { + if i+1 != len(v.(Slice)) { + where += "?," + } else { + where += "?) " + } + //res=append(res,(v.(Slice))[i]) } - //res=append(res,(v.(Slice))[i]) } + } else { where += "`" + k + "`=? " res = append(res, v)