Documentation ¶
Index ¶
- Variables
- type And
- type Builder
- func (b Builder) Column(column interface{}) Builder
- func (b Builder) Columns(columns ...string) Builder
- func (b Builder) From(from string) Builder
- func (b Builder) FromSelect(from Builder, alias string) Builder
- func (b Builder) GroupBy(groupBys ...string) Builder
- func (b Builder) Having(pred interface{}) Builder
- func (b Builder) Limit(limit int) Builder
- func (b Builder) MustSQL() string
- func (b Builder) Offset(offset int) Builder
- func (b Builder) Options(options ...string) Builder
- func (b Builder) OrderBy(orderBys ...string) Builder
- func (b Builder) OrderByClause(pred interface{}) Builder
- func (b Builder) Prefix(sql string) Builder
- func (b Builder) RemoveLimit() Builder
- func (b Builder) RemoveOffset() Builder
- func (b Builder) SetColumns(columns ...string) Builder
- func (b Builder) Suffix(sql string) Builder
- func (b Builder) ToSQL() (string, error)
- func (b Builder) Where(predicate interface{}) Builder
- type Eq
- type Fragment
- type Gt
- type GtOrEq
- type Like
- type Lt
- type LtOrEq
- type NotEq
- type NotLike
- type Or
- type SQLizer
Constants ¶
This section is empty.
Variables ¶
var Empty = sb
Empty is a empty builder useful for
Functions ¶
This section is empty.
Types ¶
type Builder ¶
Builder is used to compose highly dynamic and reusable SOQL queries
func String ¶
String returns a SelectBuilder composed as a singular string. This builder should not be extended as the query is stored and prepended as a prefix to form the entire query. Its used to satisy the requests.SQLizer signature when a string is the only input.
func (Builder) FromSelect ¶
FromSelect sets a subquery into the FROM clause of the query.
func (Builder) Options ¶
Options adds an additional clause between SELECT and COLUMNS, not sure if this has any application within SOQL but I'll keep it in case it proves useful one day (I don't think its unreasonable to expect Salesforce to port more features from Postgres/MariaDB/etc over time)
func (Builder) OrderByClause ¶
OrderByClause appends an OrderBy clause to selectData
func (Builder) RemoveLimit ¶
RemoveLimit removes a limit from a query
func (Builder) RemoveOffset ¶
RemoveOffset removes an offset from the queery
func (Builder) SetColumns ¶
SetColumns is like Columns but it replaces existing columns rather then extending them
func (Builder) Where ¶
Where builds a where clause using nested SQLizers. Each SQLizer is responsible for serializing itself and any nested SQLizer, so all the SelectBuilder needs to do is maintain and apply a list of top-level SQLizers. See expressions.go for how the SQLizers work in practice.
The following types are accepted as a predicate (as seen in newWhereSQLizer()):
switch predicate.(type) { case nil:
// noop return "", nil
case SQLizer:
return pred.ToSQL()
case map[string]interface{}:
return Eq(pred).ToSQL()
case string:
return pred, nil
type Eq ¶
type Eq map[string]interface{}
Eq produces a complex clause for use by Where/Having methods. It may contain nested values and lists which are converted into IN queries.