1
0
mirror of https://github.com/astaxie/beego.git synced 2024-11-22 02:20:54 +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,
"nq": true,
"ne": true,
">": true,
">=": true,
"<": true,
"<=": true,
"=": true,
"!=": true,
"startswith": true,
"endswith": true,
"istartswith": true,

View File

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

View File

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

View File

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

View File

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