Skip to content

Instance Method

orWhere(group:)

Builds a grouped WHERE expression by inclusive disjunction (OR).
@discardableResult func orWhere(group: (SQLPredicateGroupBuilder) throws -> SQLPredicateGroupBuilder) rethrows -> Self

Discussion

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

The above code would result in the following SQL.

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