From 977051905113de0f6f5ad77486b8e0a7bffd9a02 Mon Sep 17 00:00:00 2001 From: boyan Date: Fri, 2 Jul 2021 21:29:23 +0800 Subject: [PATCH] used equalOpr when list-type value.Len()==1 --- expr.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/expr.go b/expr.go index 4c943e5e..dc384d36 100644 --- a/expr.go +++ b/expr.go @@ -189,6 +189,9 @@ func (eq Eq) toSQL(useNotOpr bool) (sql string, args []interface{}, err error) { if args == nil { args = []interface{}{} } + } else if valVal.Len() == 1 { + expr = fmt.Sprintf("%s %s ?", key, equalOpr) + args = append(args, valVal.Index(0).Interface()) } else { for i := 0; i < valVal.Len(); i++ { args = append(args, valVal.Index(i).Interface())