mirror of
https://github.com/groue/GRDB.swift
synced 2026-11-30 04:28:44 +00:00
README.md
This commit is contained in:
1 parent
dfd7b0a912
commit
d53a58c528
1 file changed
+3
-12
@@ -527,7 +527,7 @@ class Person : RowModel {
|
||||
if let v = row["age"] { age = v.value() } // String
|
||||
if let v = row["creationTimestamp"] { // NSDate
|
||||
// Use the DBDate custom type declared above:
|
||||
let dbDate: DBDate? = v.value()
|
||||
let dbDate = v.value() as DBDate?
|
||||
creationDate = dbDate?.date
|
||||
}
|
||||
}
|
||||
@@ -564,15 +564,8 @@ Declare a **Primary Key** and a **Table name** in order to fetch row models by p
|
||||
|
||||
```swift
|
||||
class Person : RowModel {
|
||||
...
|
||||
|
||||
override class var databaseTableName: String? {
|
||||
return "persons"
|
||||
}
|
||||
|
||||
override class var databasePrimaryKey: PrimaryKey {
|
||||
return .RowID("id")
|
||||
}
|
||||
override class var databaseTableName: String? { return "persons" }
|
||||
override class var databasePrimaryKey: PrimaryKey { return .RowID("id") }
|
||||
}
|
||||
|
||||
dbQueue.inDatabase { db in
|
||||
@@ -666,8 +659,6 @@ Those operations require one more method:
|
||||
|
||||
```swift
|
||||
class Person : RowModel {
|
||||
...
|
||||
|
||||
// The values stored in the database:
|
||||
override var databaseDictionary: [String: SQLiteValueConvertible?] {
|
||||
return [
|
||||
|
||||
Reference in new issue
Block a user