Documentation ¶
Index ¶
- Constants
- Variables
- func ConvertFromLikeSearch(word string) string
- func CreateManyORParams(params []sql.NamedArg, where string, query *gorm.DB) *gorm.DB
- func FilterWay(filterWay string) func(string, string) (string, string)
- type FilterAndSortBackend
- type FilterAndSortInterface
- type FilterFunc
- type FilterOption
- type FilterParameter
- type FilterQuerySet
- type FilterViewInterface
- type FilteringMethod
- type Parameters
- type QueryParam
- type SortKey
- type SortOption
- type TypeQueryParam
Constants ¶
View Source
const ( REQUES_PARAM_SORT_KEY = "sort" SEPARATOR_METHOD_VALUE = "_" ASC SortKey = "asc" DESC SortKey = "desc" GT FilteringMethod = "gt" GTE FilteringMethod = "gte" LT FilteringMethod = "lt" LTE FilteringMethod = "lte" EQ FilteringMethod = "eq" IN FilteringMethod = "in" LIKE FilteringMethod = "like" )
Variables ¶
View Source
var ( FilterAssociations map[FilteringMethod]string = map[FilteringMethod]string{ GT: ">", GTE: ">=", LT: "<", LTE: "<=", EQ: "=", IN: "IN", LIKE: "LIKE", } )
Functions ¶
func ConvertFromLikeSearch ¶
func CreateManyORParams ¶
Types ¶
type FilterAndSortBackend ¶
type FilterAndSortBackend struct { FilterParams []FilterOption SortParams SortOption }
func NewFilter ¶
func NewFilter(r *http.Request, view FilterViewInterface) *FilterAndSortBackend
type FilterAndSortInterface ¶
type FilterFunc ¶
func WhereFilter ¶
func WhereFilter(param string) FilterFunc
type FilterOption ¶
type FilterOption struct { Field string Value interface{} CollName string FilteringMethod FilteringMethod FilterFunc func(*gorm.DB, interface{}) *gorm.DB TypeQueryParam TypeQueryParam }
func (*FilterOption) ValidateQueryParams ¶
func (f *FilterOption) ValidateQueryParams(value string) bool
type FilterParameter ¶
type FilterQuerySet ¶
type FilterViewInterface ¶
type FilterViewInterface interface { GetFilteredFields() []FilterQuerySet GetSortAllowFields() []FilterQuerySet }
type FilteringMethod ¶
type FilteringMethod string
type Parameters ¶
type Parameters struct { FilterOption []FilterOption SortOption SortOption }
func FilterFromRequest ¶
func FilterFromRequest(r *http.Request, filterFields []FilterQuerySet, sortAllowFields []FilterQuerySet) Parameters
type QueryParam ¶
type QueryParam struct { TypeQueryParam TypeQueryParam `json:"typeQueryParam"` Enum []string `json:"enum"` Directory string `json:"directory"` }
type SortOption ¶
type TypeQueryParam ¶
type TypeQueryParam string
const ( Number TypeQueryParam = "number" Boolean TypeQueryParam = "bool" String TypeQueryParam = "string" Date TypeQueryParam = "date" )
Click to show internal directories.
Click to hide internal directories.