NetNewsWire/Frameworks/ArticlesDatabase/Extensions/ArticleStatus+Database.swift

35 lines
826 B
Swift
Raw Normal View History

2017-07-04 00:04:31 +02:00
//
// ArticleStatus+Database.swift
// NetNewsWire
2017-07-04 00:04:31 +02:00
//
// Created by Brent Simmons on 7/3/17.
// Copyright © 2017 Ranchero Software. All rights reserved.
//
import Foundation
import RSDatabase
import Articles
2017-07-04 00:04:31 +02:00
extension ArticleStatus {
convenience init(articleID: String, dateArrived: Date, row: FMResultSet) {
2017-07-04 00:04:31 +02:00
let read = row.bool(forColumn: DatabaseKey.read)
let starred = row.bool(forColumn: DatabaseKey.starred)
self.init(articleID: articleID, read: read, starred: starred, dateArrived: dateArrived)
2017-07-04 00:04:31 +02:00
}
}
extension ArticleStatus: DatabaseObject {
public var databaseID: String {
return articleID
}
public func databaseDictionary() -> DatabaseDictionary? {
return [DatabaseKey.articleID: articleID, DatabaseKey.read: read, DatabaseKey.starred: starred, DatabaseKey.dateArrived: dateArrived]
}
2017-09-16 20:04:29 +02:00
}