mirror of
https://github.com/groue/GRDB.swift
synced 2026-11-28 04:24:20 +00:00
Prefer flatMap to guard when chaining values
This commit is contained in:
1 parent
027b1f711c
commit
591197422d
1 file changed
+1
-4
@@ -22,9 +22,6 @@ public extension RawRepresentable where Self: DatabaseValueConvertible, Self.Raw
|
||||
|
||||
/// Returns a value initialized from *databaseValue*, if possible.
|
||||
static func fromDatabaseValue(_ databaseValue: DatabaseValue) -> Self? {
|
||||
guard let rawValue = RawValue.fromDatabaseValue(databaseValue) else {
|
||||
return nil
|
||||
}
|
||||
return self.init(rawValue: rawValue)
|
||||
return RawValue.fromDatabaseValue(databaseValue).flatMap { self.init(rawValue: $0) }
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user