예제 #1
0
func (b *QueryBuilder) OrWhere(parts ...interface{}) *QueryBuilder {
	wherePart := b.sqlParts[where]
	if len(wherePart) == 1 {
		if exp, ok := wherePart[0].(*expression.Expression); ok && exp.Type == expression.OR {
			return b.add(where, []interface{}{exp.Add(parts...)}, false)
		}
		return b.add(where,
			[]interface{}{expression.Or(append([]interface{}{wherePart[0]}, parts...)...)},
			false)
	}
	return b.add(where, []interface{}{expression.Or(parts...)}, false)
}
예제 #2
0
// OrHaving adds a restriction over the groups of the query, forming a logical
// disjunction with any existing having restrictions.
func (b *QueryBuilder) OrHaving(parts ...interface{}) *QueryBuilder {
	if len(b.sqlParts[having]) > 0 {
		return b.add(having, []interface{}{expression.Or(b.sqlParts[having][0]).Add(parts...)}, false)
	}
	return b.add(having, []interface{}{expression.Or(parts...)}, false)
}