mirror of
https://github.com/lux-tel/session-ios.git
synced 2026-10-30 20:38:32 +00:00
31 lines
903 B
Swift
31 lines
903 B
Swift
// Copyright © 2022 Rangeproof Pty Ltd. All rights reserved.
|
|
//
|
|
// stringlint:disable
|
|
|
|
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: ObservingDatabase) -> 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)
|
|
}
|
|
}
|