mirror of
https://github.com/hanzoai/sqlbuilder.git
synced 2026-10-01 00:37:42 +00:00
fix #11. change not equal operator from != to <>.
This commit is contained in:
@@ -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
@@ -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) },
|
||||
|
||||
Reference in New Issue
Block a user