Example #1
0
func (this *GenericTranslator) CreateQueryProcessor(query *db.Query) QueryProcessor {
	proc := this.QueryProcessorFactory()

	proc.Column(query)
	if query.GetTable() != nil {
		proc.From(query)
	} else {
		proc.FromSubQuery(query)
	}
	proc.Where(query)
	// it is after the where clause because the joins can go to the where clause,
	// and this way the restrictions over the driving table will be applied first
	AppendJoins(query.GetJoins(), proc)
	proc.Group(query)
	proc.Having(query)
	proc.Union(query)
	proc.Order(query)

	return proc
}