Row adopts Hashable

This commit is contained in:
Gwendal Roué committed 2017-01-04 06:52:57 +01:00
1 parent fd0e4c20ee
commit d866bc9044
2 files changed
+12 -1

No files matched your search

+2 -1
View File
@@ -1,10 +1,11 @@
Release Notes
=============
## Next Release
## Next Version
**New**
- `Row` adopts the Hashable protocol
- [FetchedRecordsController](https://github.com/groue/GRDB.swift#fetchedrecordscontroller) now outputs detailed change events on all platforms, and for both table and collection views. Merged [#160](https://github.com/groue/GRDB.swift/pull/160) by [@kdubb](https://github.com/kdubb).
+10
View File
@@ -766,6 +766,7 @@ extension Row : Collection {
}
}
/// Row adopts Equatable.
extension Row : Equatable {
/// Returns true if and only if both rows have the same columns and values,
@@ -809,6 +810,15 @@ extension Row : Equatable {
}
}
/// Row adopts Hashable.
extension Row : Hashable {
/// The hash value
public var hashValue: Int {
return columnNames.reduce(0) { (acc, column) in acc ^ column.hashValue } ^
databaseValues.reduce(0) { (acc, dbv) in acc ^ dbv.hashValue }
}
}
/// Row adopts CustomStringConvertible.
extension Row: CustomStringConvertible {
/// A textual representation of `self`.