fix #11. change not equal operator from != to <>.

This commit is contained in:
Huan Du
2018-06-27 19:02:58 +08:00
parent 57e0443620
commit 724122b919
2 changed files with 3 additions and 3 deletions
+1 -1
View File
@@ -25,7 +25,7 @@ func (c *Cond) E(field string, value interface{}) string {
// NotEqual represents "field != value".
func (c *Cond) NotEqual(field string, value interface{}) string {
return fmt.Sprintf("%v != %v", Escape(field), c.Args.Add(value))
return fmt.Sprintf("%v <> %v", Escape(field), c.Args.Add(value))
}
// NE is an alias of NotEqual.
+2 -2
View File
@@ -11,8 +11,8 @@ func TestCond(t *testing.T) {
cases := map[string]func() string{
"$$a = $0": func() string { return newTestCond().Equal("$a", 123) },
"$$b = $0": func() string { return newTestCond().E("$b", 123) },
"$$a != $0": func() string { return newTestCond().NotEqual("$a", 123) },
"$$b != $0": func() string { return newTestCond().NE("$b", 123) },
"$$a <> $0": func() string { return newTestCond().NotEqual("$a", 123) },
"$$b <> $0": func() string { return newTestCond().NE("$b", 123) },
"$$a > $0": func() string { return newTestCond().GreaterThan("$a", 123) },
"$$b > $0": func() string { return newTestCond().G("$b", 123) },
"$$a >= $0": func() string { return newTestCond().GreaterEqualThan("$a", 123) },