Documentation ¶
Index ¶
Constants ¶
View Source
const ( FILTER = "filter" SORT = "sort" PAGE = "page" ASC = "ASC" DESC = "DESC" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Builder ¶
type Builder struct {
// contains filtered or unexported fields
}
func NewQueryBuilder ¶
func (*Builder) BuildQuery ¶
type Filter ¶
type Filter interface {
Parse(interface{}) error
}
func ParseFilter ¶ added in v1.10.1
ParseFilter parses a filter struct using the visitor pattern returning a built Filter interface.
type Pagination ¶
type Query ¶
type Query struct { QueryFields `json:",inline"` // derived from Filters Filter Filter }
func (*Query) UnmarshalJSON ¶
type QueryFields ¶ added in v1.9.0
type QueryFields struct { Filters map[string]interface{} `json:"filter"` Sort []Sorting `json:"sort"` Page Pagination `json:"page"` }
used only for intermediate query value.
type Visitor ¶
type Visitor interface { // returns "equal" expression VisitEQ(*EQ) (string, error) // returns "not equal" expression VisitNEQ(*NEQ) (string, error) // returns "greater than" expression VisitGT(*GT) (string, error) // returns "greater than equal" expression VisitGTE(*GTE) (string, error) // returns "less than" expression VisitLT(*LT) (string, error) // returns "less than equal" expression VisitLTE(*LTE) (string, error) // returns "in" expression VisitIN(*IN) (string, error) // returns "and" expression VisitAND(*AND) (string, error) // returns "or" expression VisitOR(*OR) (string, error) // receives concatenated filters and finalizes the native query Finalize(string, *Query) error }
Click to show internal directories.
Click to hide internal directories.