README.md

This commit is contained in:
Gwendal Roué committed 2015-07-03 21:27:02 +02:00
1 parent 8b6a2eda1d
commit 74142ae618
1 file changed
+18 -6
+18 -6
View File
@@ -81,7 +81,14 @@ A rollback statement is issued if an error is thrown from the transaction block.
## Fetch Queries
**Row Queries** load database rows:
You can load rows and values from the database.
- [Row Queries](#row-queries)
- [Value Queries](#value-queries)
- [Custom Values](#custom-values)
-
### Row Queries
```swift
dbQueue.inDatabase { db in
@@ -148,7 +155,9 @@ let rows = dbQueue.inDatabase { db in
```
**Values queries** load value types:
### Value Queries
The library ships with built-in support for `Bool`, `Int`, `Int64`, `Double` and `String` (TODO: binary blob):
```swift
dbQueue.inDatabase { db in
@@ -161,9 +170,6 @@ dbQueue.inDatabase { db in
}
```
GRDB.swift ships with built-in support for `Bool`, `Int`, `Int64`, `Double` and `String` (TODO: binary blob).
**Enum types** are supported through the `DatabaseEnum` type:
```swift
@@ -193,7 +199,13 @@ let color = dbColor.value
**Custom types** can be inserted and loaded by adopting the `DatabaseValueType` protocol:
### Custom Values
Your custom types can be inserted and loaded by adopting the `DatabaseValueType` protocol.
As long as you can represent your type as one of the five [datatypes](https://www.sqlite.org/datatype3.html) supported by SQLite, namely NULL, INTEGER, REAL, TEXT, and BLOB, your type is fully supported by GRDB.swift.
For example, let's define below the `DatabaseDate` type that stores and loads an NSDate in the database through its timestamp:
```swift
struct DatabaseDate: DatabaseValueType {