mirror of
https://github.com/astaxie/beego.git
synced 2024-12-22 12:50:49 +00:00
Merge pull request #4230 from jianzhiyao/frt/movement_for_4198
movement for 4198
This commit is contained in:
commit
a31dce6216
@ -38,10 +38,11 @@ var (
|
||||
|
||||
var (
|
||||
operators = map[string]bool{
|
||||
"exact": true,
|
||||
"iexact": true,
|
||||
"contains": true,
|
||||
"icontains": true,
|
||||
"exact": true,
|
||||
"iexact": true,
|
||||
"strictexact": true,
|
||||
"contains": true,
|
||||
"icontains": true,
|
||||
// "regex": true,
|
||||
// "iregex": true,
|
||||
"gt": true,
|
||||
|
@ -22,10 +22,11 @@ import (
|
||||
|
||||
// mysql operators.
|
||||
var mysqlOperators = map[string]string{
|
||||
"exact": "= ?",
|
||||
"iexact": "LIKE ?",
|
||||
"contains": "LIKE BINARY ?",
|
||||
"icontains": "LIKE ?",
|
||||
"exact": "= ?",
|
||||
"iexact": "LIKE ?",
|
||||
"strictexact": "= BINARY ?",
|
||||
"contains": "LIKE BINARY ?",
|
||||
"icontains": "LIKE ?",
|
||||
// "regex": "REGEXP BINARY ?",
|
||||
// "iregex": "REGEXP ?",
|
||||
"gt": "> ?",
|
||||
|
@ -877,6 +877,17 @@ func TestOperators(t *testing.T) {
|
||||
throwFail(t, err)
|
||||
throwFail(t, AssertIs(num, 1))
|
||||
|
||||
if IsMysql {
|
||||
// Now only mysql support `strictexact`
|
||||
num, err = qs.Filter("user_name__strictexact", "Slene").Count()
|
||||
throwFail(t, err)
|
||||
throwFail(t, AssertIs(num, 0))
|
||||
|
||||
num, err = qs.Filter("user_name__strictexact", "slene").Count()
|
||||
throwFail(t, err)
|
||||
throwFail(t, AssertIs(num, 1))
|
||||
}
|
||||
|
||||
num, err = qs.Filter("user_name__contains", "e").Count()
|
||||
throwFail(t, err)
|
||||
throwFail(t, AssertIs(num, 2))
|
||||
|
Loading…
Reference in New Issue
Block a user