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 == "[#]" {
|
} else if k == "[#]" {
|
||||||
k = strings.Replace(k, "[#]", "", -1)
|
k = strings.Replace(k, "[#]", "", -1)
|
||||||
where += " " + ObjToStr(v) + " "
|
where += " " + ObjToStr(v) + " "
|
||||||
} else {
|
} else {
|
||||||
//fmt.Println(reflect.ValueOf(v).Type().String())
|
//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)
|
//fmt.Println(v)
|
||||||
where += "`" + k + "` IN ("
|
where += "`" + k + "` IN ("
|
||||||
@ -721,13 +723,9 @@ func (this *HoTimeDB) varCond(k string, v interface{}) (string, []interface{}) {
|
|||||||
//res=append(res,(v.(Slice))[i])
|
//res=append(res,(v.(Slice))[i])
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if v!=nil{
|
|
||||||
where += "`" + k + "`=? "
|
where += "`" + k + "`=? "
|
||||||
res = append(res, v)
|
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{}) {
|
func (this *HoTimeDB) notIn(k string, v interface{}, where string, res []interface{}) (string, []interface{}) {
|
||||||
//where:=""
|
//where:=""
|
||||||
//fmt.Println(reflect.ValueOf(v).Type().String())
|
//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 ("
|
where += "`" + k + "` NOT IN ("
|
||||||
res = append(res, (v.(Slice))...)
|
res = append(res, (v.(Slice))...)
|
||||||
for i := 0; i < len(v.(Slice)); i++ {
|
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])
|
//res=append(res,(v.(Slice))[i])
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if v!=nil{
|
|
||||||
where += "`" + k + "` !=? "
|
where += "`" + k + "` !=? "
|
||||||
res = append(res, v)
|
res = append(res, v)
|
||||||
}else{
|
|
||||||
where += "`" + k + "` IS NOT NULL "
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user