Skip to content

The filter method CAN be renamed to where #571

@Evertt

Description

@Evertt

First of all I want to say, what an awesome library. I love being able to communicate with an SQLite database in a type-safe way.

So let's get to the point. In the docs you say you called the query method used for the WHERE clause in a query filter, because where was a reserved name. iIf you write the function like this:

extension QueryType {
    public func `where`(_ predicate: Expression<Bool?>) -> Self {
        var query = self
        query.clauses.filters = query.clauses.filters.map { $0 && predicate } ?? predicate
        return query
    }
}

You can actually use it like: users.where(id == 1).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions