 //
 //  Attachment+Database.swift
-//  Database
+//  NetNewsWire
 //
 //  Created by Brent Simmons on 7/4/17.
 //  Copyright © 2017 Ranchero Software. All rights reserved.

		let attachments = parsedAttachments.compactMap{ Attachment(parsedAttachment: $0) }
		return attachments.isEmpty ? nil : Set(attachments)
	}

}

private func optionalIntForColumn(_ row: FMResultSet, _ columnName: String) -> Int? {
	
	let intValue = row.long(forColumn: columnName)
	if intValue < 1 {
		return nil
	}
	return intValue
}

extension Attachment: DatabaseObject {
	


}

private extension FMResultSet {

	func optionalIntForColumn(_ columnName: String) -> Int? {
		let intValue = long(forColumn: columnName)
		if intValue < 1 {
			return nil
		}
		return intValue
	}
}

extension Set where Element == Attachment {

	func databaseDictionaries() -> [DatabaseDictionary] {
		return self.compactMap { $0.databaseDictionary() }
	}

	func databaseObjects() -> [DatabaseObject] {
		return self.compactMap { $0 as DatabaseObject }
	}
}
