This commit is contained in:
parent
d7d7227ad8
commit
fcb784e351
24
db.go
24
db.go
@ -694,9 +694,11 @@ func (this *HoTimeDB) varCond(k string, v interface{}) (string, []interface{}) {
|
||||
} else if k == "[#]" {
|
||||
k = strings.Replace(k, "[#]", "", -1)
|
||||
where += " " + ObjToStr(v) + " "
|
||||
} else {
|
||||
} else {
|
||||
//fmt.Println(reflect.ValueOf(v).Type().String())
|
||||
if reflect.ValueOf(v).Type().String() == "hotime.Slice" {
|
||||
if v==nil{
|
||||
where += "`" + k + "` IS NULL"
|
||||
}else if reflect.ValueOf(v).Type().String() == "hotime.Slice" {
|
||||
|
||||
//fmt.Println(v)
|
||||
where += "`" + k + "` IN ("
|
||||
@ -721,13 +723,9 @@ func (this *HoTimeDB) varCond(k string, v interface{}) (string, []interface{}) {
|
||||
//res=append(res,(v.(Slice))[i])
|
||||
}
|
||||
} else {
|
||||
if v!=nil{
|
||||
|
||||
where += "`" + k + "`=? "
|
||||
res = append(res, v)
|
||||
}else{
|
||||
where += "`" + k + "` IS NULL"
|
||||
//res = append(res, v)
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@ -739,7 +737,11 @@ func (this *HoTimeDB) varCond(k string, v interface{}) (string, []interface{}) {
|
||||
func (this *HoTimeDB) notIn(k string, v interface{}, where string, res []interface{}) (string, []interface{}) {
|
||||
//where:=""
|
||||
//fmt.Println(reflect.ValueOf(v).Type().String())
|
||||
if reflect.ValueOf(v).Type().String() == "hotime.Slice" {
|
||||
if v==nil{
|
||||
|
||||
where += "`" + k + "` IS NOT NULL "
|
||||
|
||||
}else if reflect.ValueOf(v).Type().String() == "hotime.Slice" {
|
||||
where += "`" + k + "` NOT IN ("
|
||||
res = append(res, (v.(Slice))...)
|
||||
for i := 0; i < len(v.(Slice)); i++ {
|
||||
@ -762,12 +764,10 @@ func (this *HoTimeDB) notIn(k string, v interface{}, where string, res []interfa
|
||||
//res=append(res,(v.(Slice))[i])
|
||||
}
|
||||
} else {
|
||||
if v!=nil{
|
||||
|
||||
where += "`" + k + "` !=? "
|
||||
res = append(res, v)
|
||||
}else{
|
||||
where += "`" + k + "` IS NOT NULL "
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user