# README
Supported filter operators
The following filter operators are supported:
:
The equality operatorfilter=username:John
matches only when the username is exactlyJohn
\>
The greater than operatorfilter=age>35
matches only when age is more than 35\<
The less than operatorfilter=salary<80000
matches only when salary is less than 80,000\>=
The greater than or equals to operatorfilter=items>=100
matches only when items is at least 100\<=
The less than or equals to operatorfilter=score<=100000
matches when score is 100,000 or lower\!=
The not equals to operatorstate!=FAIL
matches when state has any value other than FAIL\~
The like operatorfilter=lastName~illi
matches when lastName contains the substringilli
Request example
curl -X GET http://localhost:8080/v1/modules?page=1&limit=10&order_by=username&order_direction=asc&filter="name:John"
Model definition
type UserModel struct {
Username string `gorm:"uniqueIndex" filter:"param:login;searchable;filterable"`
FullName string `filter:"searchable"`
Role string `filter:"filterable"`
}
The param
tag defines a custom column name for the query parameter.
# Functions
FilterByQuery filters the response by query parameters.