Browse Source

'fix'

master
u 2 years ago
parent
commit
b16628df01
  1. 27
      builder2.go

27
builder2.go

@ -255,19 +255,26 @@ func toWhereSql(where interface{}) (string, error) {
whereSql = strings.Join(ws, fmt.Sprintf(" %s ", operator))
}
} else {
for _, w := range expression {
if w.Type == gjson.String {
ws = append(ws, w.String())
} else {
newExp, err := toWhereSql(w.Value())
if err != nil {
return "", err
}
ws = append(ws, newExp)
// ["and",["a","=","1"],"or",["b",">","2"]]
//三段式
if len(expression) == 3 {
ws = append(ws, expression[0].String(), expression[1].String(), expression[2].Raw)
}
// for _, w := range expression {
// if w.Type == gjson.String {
// ws = append(ws, w.String())
// } else {
// newExp, err := toWhereSql(w.Value())
// if err != nil {
// return "", err
// }
// ws = append(ws, newExp)
// }
whereSql = strings.Join(ws, " ")
}
// }
}
} else if whereGjson.IsObject() {
newValue := []interface{}{

Loading…
Cancel
Save