README.md

This commit is contained in:
Gwendal Roué committed 2016-01-30 13:58:52 +01:00
1 parent 841882510e
commit e28817829c
1 file changed
+2 -2
+2 -2
View File
@@ -1005,13 +1005,13 @@ public protocol DatabaseValueConvertible {
}
```
All types that adopt this protocol can be used wherever the built-in types `Int`, `String`, etc. are used. without any limitation or caveat. Those built-in types actually adopt it.
All types that adopt this protocol can be used like all other [value types](#values) (Bool, Int, String, NSDate, Swift enums, etc.)
The `databaseValue` property returns [DatabaseValue](GRDB/Core/DatabaseValue.swift), a type that wraps the five types supported by SQLite: NULL, Int64, Double, String and NSData. DatabaseValue has no public initializer: to create one, use `DatabaseValue.Null`, or another type that already adopts the protocol: `1.databaseValue`, `"foo".databaseValue`, etc.
The `fromDatabaseValue()` factory method returns an instance of your custom type, if the databaseValue contains a suitable value.
As an example, see [DatabaseTimestamp](https://gist.github.com/groue/ab172d2ee3344a0bfed1), an alternative to the built-in [NSDate](#nsdate-and-nsdatecomponents), which stores dates as timestamps.
As an example, see [DatabaseTimestamp](https://gist.github.com/groue/ab172d2ee3344a0bfed1), an alternative to the built-in [NSDate](#nsdate-and-nsdatecomponents). DatabaseTimestamp stores dates as timestamps.
## Prepared Statements