mirror of
https://github.com/groue/GRDB.swift
synced 2026-11-24 04:07:47 +00:00
Sync README.md sample code with actually tested code.
This commit is contained in:
1 parent
ff9b2c8bda
commit
05264d4ba9
2 files changed
+2
-1
No files matched your search
@@ -34,6 +34,7 @@ struct DatabaseTimestamp: DatabaseValueConvertible {
|
||||
// Double itself adopts DatabaseValueConvertible. So let's avoid
|
||||
// handling the raw DatabaseValue, and use built-in Double conversion:
|
||||
guard let timeInterval = Double.fromDatabaseValue(databaseValue) else {
|
||||
// No Double, no NSDate!
|
||||
return nil
|
||||
}
|
||||
return DatabaseTimestamp(NSDate(timeIntervalSince1970: timeInterval))
|
||||
|
||||
@@ -615,7 +615,7 @@ struct DatabaseTimestamp: DatabaseValueConvertible {
|
||||
|
||||
/// Returns a value that can be stored in the database.
|
||||
var databaseValue: DatabaseValue {
|
||||
return .Real(date.timeIntervalSince1970)
|
||||
return DatabaseValue(double: date.timeIntervalSince1970)
|
||||
}
|
||||
|
||||
/// Returns an instance initialized from *databaseValue*, if possible.
|
||||
|
||||
Reference in new issue
Block a user