mirror of
https://github.com/groue/GRDB.swift
synced 2026-11-28 04:24:20 +00:00
Row adopts Hashable
This commit is contained in:
1 parent
fd0e4c20ee
commit
d866bc9044
2 files changed
+12
-1
No files matched your search
+2
-1
@@ -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).
|
||||
|
||||
|
||||
|
||||
@@ -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`.
|
||||
|
||||
Reference in new issue
Block a user