Skip to content

Instance Method

orHaving(group:)

Builds a grouped HAVING expression by inclusive disjunction (‘OR’).
@discardableResult func orHaving(group: (SQLSecondaryPredicateGroupBuilder) throws -> SQLSecondaryPredicateGroupBuilder) rethrows -> Self

Discussion

builder.having("name", .equal, "Jupiter").orHaving {
    $0.having("name", .equal, "Earth").having("type", .equal, PlanetType.smallRocky)
}

The above code would result in the following SQL.

HAVING "name" = "Jupiter" OR ("name" = "Earth" AND "type" = "smallRocky")