Skip to content
This repository was archived by the owner on Jun 14, 2019. It is now read-only.

Commit 0431863

Browse files
committed
Fix empty IN/NOT IN conditions
1 parent c6e604e commit 0431863

File tree

2 files changed

+4
-8
lines changed

2 files changed

+4
-8
lines changed

cond_in.go

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,8 @@ func In(col string, values ...interface{}) Cond {
2323
}
2424

2525
func (condIn condIn) handleBlank(w Writer) error {
26-
if _, err := fmt.Fprintf(w, "%s IN ()", condIn.col); err != nil {
27-
return err
28-
}
29-
return nil
26+
_, err := fmt.Fprint(w, "0=1")
27+
return err
3028
}
3129

3230
func (condIn condIn) WriteTo(w Writer) error {

cond_notin.go

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,8 @@ func NotIn(col string, values ...interface{}) Cond {
2020
}
2121

2222
func (condNotIn condNotIn) handleBlank(w Writer) error {
23-
if _, err := fmt.Fprintf(w, "%s NOT IN ()", condNotIn.col); err != nil {
24-
return err
25-
}
26-
return nil
23+
_, err := fmt.Fprint(w, "0=0")
24+
return err
2725
}
2826

2927
func (condNotIn condNotIn) WriteTo(w Writer) error {

0 commit comments

Comments
 (0)