From e1fbeb935d039ee3106b00d4aca7976eed13a620 Mon Sep 17 00:00:00 2001 From: u Date: Thu, 16 Feb 2023 15:28:31 +0800 Subject: [PATCH] 'fix' --- builder2.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/builder2.go b/builder2.go index 1757a22..25c43a5 100644 --- a/builder2.go +++ b/builder2.go @@ -248,6 +248,9 @@ func toWhereSql(where interface{}) (string, error) { if whereSql == "" && (w.String() == "and" || w.String() == "or") { operator = w.String() } else { + if w.String() == "" { + continue + } ws = append(ws, w.String()) } } else { @@ -255,6 +258,9 @@ func toWhereSql(where interface{}) (string, error) { if err != nil { return "", err } + if newExp == "" { + continue + } ws = append(ws, newExp) } @@ -316,6 +322,9 @@ func toWhereSql(where interface{}) (string, error) { } else { whereSql = whereGjson.String() } + if strings.TrimSpace(whereSql) == "" { + return "", nil + } return fmt.Sprintf("( %s )", whereSql), nil }