Documentation ¶
Index ¶
- type Query
- func (self Query) Count() (count int, err error)
- func (self *Query) Join(objects ...base.Base) *Query
- func (self *Query) Limit(limit int) *Query
- func (self *Query) Offset(offset int) *Query
- func (self *Query) Order(order ...qtypes.Queryable) *Query
- func (self *Query) OrderBy(orderStatements ...qtypes.Queryable) *Query
- func (self Query) PrintQuery() string
- func (self Query) Results() (*qtypes.QueryResults, error)
- func (self *Query) Select(stmnts ...qtypes.Selectable) *Query
- func (self Query) String() string
- func (self *Query) Where(clauses ...qtypes.Queryable) *Query
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Query ¶
type Query struct { Pool *pool.ConnectionPool Tables *qtypes.AliasedTables WhereClauses []qtypes.Queryable SelectExpressions []qtypes.SelectExpression OptionClauses []qtypes.QueryOption Errors []error // contains filtered or unexported fields }
Query represents an in-flight query that is being built as before actually making the request to the DB. It's purpose is to facillitate a more straightforward interaction with the DB for general purpose usage to avoid having to write direct SQL.
func NewQuery ¶
func NewQuery(pool *pool.ConnectionPool) *Query
NewQuery returns a new Query object attached to a specified pool.
func (Query) Count ¶ added in v0.2.1
Count makes a call to the db to get the total count that would be returned from the query without any extra QueryOptions (limit, offset, etc).
func (*Query) Join ¶
Join adds an object to the query. The joined object should have a Relationship with at least one other object already in the Query.
func (*Query) OrderBy ¶
OrderBy adds an ordering to the query. Repeated calls to this function will append to the existing ordering.
func (Query) PrintQuery ¶
PrintQuery prints what query will be made when the query is called.
func (Query) Results ¶
func (self Query) Results() (*qtypes.QueryResults, error)
Results returns the query as a QueryResults object that can be used to read data out of the database in a convenient fashion.
func (*Query) Select ¶
func (self *Query) Select(stmnts ...qtypes.Selectable) *Query
Select sets the selected data for the Query. Repeated calls to this function will Override the existing select clause.