Skip to content

Instance Method

where(group:)

Builds a grouped WHERE expression by conjunction (AND).
@discardableResult func `where`(group: (SQLPredicateGroupBuilder) throws -> SQLPredicateGroupBuilder) rethrows -> Self

Discussion

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

The above code would result in the following SQL.

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