mirror of https://github.com/oxen-io/session-ios
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 lines
869 B
Swift
29 lines
869 B
Swift
// Copyright © 2022 Rangeproof Pty Ltd. All rights reserved.
|
|
|
|
import Foundation
|
|
import GRDB
|
|
|
|
public extension QueryInterfaceRequest {
|
|
/// Returns true if the request matches a row in the database.
|
|
///
|
|
/// try Player.filter(Column("name") == "Arthur").isEmpty(db)
|
|
///
|
|
/// - parameter db: A database connection.
|
|
/// - returns: Whether the request matches a row in the database.
|
|
///
|
|
/// stringlint:ignore_contents
|
|
func isNotEmpty(_ db: Database) -> Bool {
|
|
return ((try? SQLRequest("SELECT \(exists())").fetchOne(db)) ?? false)
|
|
}
|
|
}
|
|
|
|
public extension QueryInterfaceRequest where RowDecoder: ColumnExpressible {
|
|
func select(_ selection: RowDecoder.Columns...) -> Self {
|
|
select(selection)
|
|
}
|
|
|
|
func order(_ orderings: RowDecoder.Columns...) -> QueryInterfaceRequest {
|
|
order(orderings)
|
|
}
|
|
}
|