Skip to content

Instance Method

having(group:)

Builds a grouped HAVING expression by conjunction (AND).
@discardableResult func having(group: (SQLSecondaryPredicateGroupBuilder) throws -> SQLSecondaryPredicateGroupBuilder) rethrows -> Self

Discussion

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

The above code would result in the following SQL.

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