mirror of
https://github.com/lux-tel/session-ios.git
synced 2026-10-30 20:38:32 +00:00
20 lines
626 B
Swift
20 lines
626 B
Swift
// Copyright © 2023 Rangeproof Pty Ltd. All rights reserved.
|
|
|
|
import GRDB
|
|
|
|
public extension FetchRequest where RowDecoder: FetchableRecord {
|
|
func fetchOne(_ db: ObservingDatabase, orThrow error: Error) throws -> RowDecoder {
|
|
guard let result: RowDecoder = try fetchOne(db) else { throw error }
|
|
|
|
return result
|
|
}
|
|
}
|
|
|
|
public extension FetchRequest where RowDecoder: DatabaseValueConvertible {
|
|
func fetchOne(_ db: ObservingDatabase, orThrow error: Error) throws -> RowDecoder {
|
|
guard let result: RowDecoder = try fetchOne(db) else { throw error }
|
|
|
|
return result
|
|
}
|
|
}
|