1
0
mirror of https://github.com/astaxie/beego.git synced 2024-06-02 13:53:27 +00:00

Add the operator(>,>=,<,<=,=,!=) of orm

eg:
qs.Filter("counts__>=","20")
qs.Filter("counts__!=","20")
This commit is contained in:
wangle 2020-07-29 23:23:02 +08:00
parent 7312197732
commit 22b8cae73b
5 changed files with 29 additions and 0 deletions

View File

@ -49,6 +49,12 @@ var (
"eq": true, "eq": true,
"nq": true, "nq": true,
"ne": true, "ne": true,
">": true,
">=": true,
"<": true,
"<=": true,
"=": true,
"!=": true,
"startswith": true, "startswith": true,
"endswith": true, "endswith": true,
"istartswith": true, "istartswith": true,

View File

@ -29,11 +29,17 @@ var mysqlOperators = map[string]string{
// "regex": "REGEXP BINARY ?", // "regex": "REGEXP BINARY ?",
// "iregex": "REGEXP ?", // "iregex": "REGEXP ?",
"gt": "> ?", "gt": "> ?",
">": "> ?",
"gte": ">= ?", "gte": ">= ?",
">=": ">= ?",
"lt": "< ?", "lt": "< ?",
"<": "< ?",
"lte": "<= ?", "lte": "<= ?",
"<=": "<= ?",
"eq": "= ?", "eq": "= ?",
"=": "= ?",
"ne": "!= ?", "ne": "!= ?",
"!=": "!= ?",
"startswith": "LIKE BINARY ?", "startswith": "LIKE BINARY ?",
"endswith": "LIKE BINARY ?", "endswith": "LIKE BINARY ?",
"istartswith": "LIKE ?", "istartswith": "LIKE ?",

View File

@ -22,10 +22,15 @@ import (
// oracle operators. // oracle operators.
var oracleOperators = map[string]string{ var oracleOperators = map[string]string{
"exact": "= ?", "exact": "= ?",
"=": "= ?",
"gt": "> ?", "gt": "> ?",
">": "> ?",
"gte": ">= ?", "gte": ">= ?",
">=": ">= ?",
"lt": "< ?", "lt": "< ?",
"<": "< ?",
"lte": "<= ?", "lte": "<= ?",
"<=": "<= ?",
"//iendswith": "LIKE ?", "//iendswith": "LIKE ?",
} }

View File

@ -26,11 +26,17 @@ var postgresOperators = map[string]string{
"contains": "LIKE ?", "contains": "LIKE ?",
"icontains": "LIKE UPPER(?)", "icontains": "LIKE UPPER(?)",
"gt": "> ?", "gt": "> ?",
">": "> ?",
"gte": ">= ?", "gte": ">= ?",
">=": ">= ?",
"lt": "< ?", "lt": "< ?",
"<": "< ?",
"lte": "<= ?", "lte": "<= ?",
"<=": "<= ?",
"eq": "= ?", "eq": "= ?",
"=": "= ?",
"ne": "!= ?", "ne": "!= ?",
"!=": "!= ?",
"startswith": "LIKE ?", "startswith": "LIKE ?",
"endswith": "LIKE ?", "endswith": "LIKE ?",
"istartswith": "LIKE UPPER(?)", "istartswith": "LIKE UPPER(?)",

View File

@ -28,11 +28,17 @@ var sqliteOperators = map[string]string{
"contains": "LIKE ? ESCAPE '\\'", "contains": "LIKE ? ESCAPE '\\'",
"icontains": "LIKE ? ESCAPE '\\'", "icontains": "LIKE ? ESCAPE '\\'",
"gt": "> ?", "gt": "> ?",
">": "> ?",
"gte": ">= ?", "gte": ">= ?",
">=": ">= ?",
"lt": "< ?", "lt": "< ?",
"<": "< ?",
"lte": "<= ?", "lte": "<= ?",
"<=": "<= ?",
"eq": "= ?", "eq": "= ?",
"=": "= ?",
"ne": "!= ?", "ne": "!= ?",
"!=": "!= ?",
"startswith": "LIKE ? ESCAPE '\\'", "startswith": "LIKE ? ESCAPE '\\'",
"endswith": "LIKE ? ESCAPE '\\'", "endswith": "LIKE ? ESCAPE '\\'",
"istartswith": "LIKE ? ESCAPE '\\'", "istartswith": "LIKE ? ESCAPE '\\'",