Browse Source

'fix'

master
u 2 years ago
parent
commit
e1fbeb935d
  1. 9
      builder2.go

9
builder2.go

@ -248,6 +248,9 @@ func toWhereSql(where interface{}) (string, error) {
if whereSql == "" && (w.String() == "and" || w.String() == "or") { if whereSql == "" && (w.String() == "and" || w.String() == "or") {
operator = w.String() operator = w.String()
} else { } else {
if w.String() == "" {
continue
}
ws = append(ws, w.String()) ws = append(ws, w.String())
} }
} else { } else {
@ -255,6 +258,9 @@ func toWhereSql(where interface{}) (string, error) {
if err != nil { if err != nil {
return "", err return "", err
} }
if newExp == "" {
continue
}
ws = append(ws, newExp) ws = append(ws, newExp)
} }
@ -316,6 +322,9 @@ func toWhereSql(where interface{}) (string, error) {
} else { } else {
whereSql = whereGjson.String() whereSql = whereGjson.String()
} }
if strings.TrimSpace(whereSql) == "" {
return "", nil
}
return fmt.Sprintf("( %s )", whereSql), nil return fmt.Sprintf("( %s )", whereSql), nil
} }

Loading…
Cancel
Save