mirror of
https://github.com/groue/GRDB.swift
synced 2026-11-24 04:07:47 +00:00
README.md
This commit is contained in:
1 parent
f7c3c12ed5
commit
781a2eed89
1 file changed
+3
-3
@@ -302,7 +302,7 @@ Ask for an optional when the value may be NULL:
|
||||
let name: String? = row.value(named: "name")
|
||||
```
|
||||
|
||||
Pick the type you need. All types that adopt the [DatabaseValueConvertible](#custom-value-types) protocol can be extracted:
|
||||
The `value` function generally returns the type you ask for:
|
||||
|
||||
```swift
|
||||
let bookCount: Int = row.value(named: "bookCount")
|
||||
@@ -313,8 +313,6 @@ let dateString: String = row.value(named: "date") // "2015-09-11 18:14:15.
|
||||
let date: NSDate = row.value(named: "date") // NSDate
|
||||
```
|
||||
|
||||
Don't miss the [NSData](#nsdata-and-memory-savings) paragraph if you target memory efficiency.
|
||||
|
||||
You can also use the `as` type casting operator:
|
||||
|
||||
```swift
|
||||
@@ -330,6 +328,8 @@ row.value(...) as Int!
|
||||
> row.value(...) as? Int // NO NO NO DON'T DO THAT!
|
||||
> ```
|
||||
|
||||
See [Values](#values) for more information on supported types. Don't miss [NSData](#nsdata-and-memory-savings) if you target memory efficiency.
|
||||
|
||||
|
||||
#### Rows as Dictionaries
|
||||
|
||||
|
||||
Reference in new issue
Block a user