Documentation ¶
Overview ¶
Package query provides a way to build queries from schema.Fields and DNF notations
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Conjunction ¶
type Conjunction []Proposition
Conjunction is a slice of Proposition to be ANDed together
type ConjunctionString ¶
type ConjunctionString []PropositionString
ConjunctionString is a slice of PropositionString to be considered as joined together by a AND
type Disjunction ¶
type Disjunction []Conjunction
Disjunction is a slice of Conjunction that will be ORed together
type DisjunctionString ¶
type DisjunctionString []ConjunctionString
DisjunctionString is a slice of ConjunctionString that will be joined together with OR
type Proposition ¶
Proposition is a triplet with schema.Field, operator, value(s)
type PropositionString ¶
type PropositionString struct { Field string `json:"field"` Operator string `json:"op"` Value interface{} `json:"val"` Table string `json:"table"` }
PropositionString is a quadruplet with field, operator, value, table all as strings
type SearchPart ¶
type SearchPart struct { Limit int `json:"limit"` Offset int `json:"offset"` DNFString DNFString `json:"dnf"` }
SearchPart is a structure that expresses a part of a SELECT clause after the WHERE (ie: a DNF for all OR/AND/(col, op, value) + limit & offset
type Selectable ¶
type Selectable interface { Where(DNF) (Selectable, error) Limit(int) (Selectable, error) Offset(int) (Selectable, error) Count() Selectable Values([]map[schema.Field]interface{}) (Selectable, error) Compile() (string, []interface{}, error) Join(schema.Field, schema.Field) (Selectable, error) }
Selectable exposes Where, Limit & Offset methods that all return another selectable the Compile method returns a string that expresses your select statement
func Delete ¶
func Delete(table schema.Table) (Selectable, error)
Delete is a function the produces a Selectable to delete from a table