FilteredRequest
public protocol FilteredRequest
The protocol for all requests that can be filtered.
-
filter(_:)
Default implementationCreates a request with the provided predicate promise added to the eventual set of already applied predicates.
// SELECT * FROM player WHERE 1 var request = Player.all() request = request.filter { db in true }
Default Implementation
Creates a request with the provided predicate added to the eventual set of already applied predicates.
// SELECT * FROM player WHERE email = 'arthur@example.com' var request = Player.all() request = request.filter(Column("email") == "arthur@example.com")
Declaration
Swift
func filter(_ predicate: @escaping (Database) throws -> SQLExpressible) -> Self
-
filter(sql:arguments:)
Extension methodCreates a request with the provided predicate added to the eventual set of already applied predicates.
// SELECT * FROM player WHERE email = 'arthur@example.com' var request = Player.all() request = request.filter(sql: "email = ?", arguments: ["arthur@example.com"])
Declaration
Swift
public func filter(sql: String, arguments: StatementArguments? = nil) -> Self
-
none()
Extension methodCreates a request that matches nothing.
// SELECT * FROM player WHERE 0 var request = Player.all() request = request.none()
Declaration
Swift
public func none() -> Self