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 ¶
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 ¶
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 "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.