2017-07-16 19:36:38 -07:00
|
|
|
//
|
2017-07-16 20:51:08 -07:00
|
|
|
// AttachmentsTable.swift
|
2017-07-16 19:36:38 -07:00
|
|
|
// Database
|
|
|
|
//
|
|
|
|
// Created by Brent Simmons on 7/15/17.
|
|
|
|
// Copyright © 2017 Ranchero Software. All rights reserved.
|
|
|
|
//
|
|
|
|
|
|
|
|
import Foundation
|
|
|
|
import RSDatabase
|
|
|
|
import Data
|
|
|
|
|
2017-09-02 10:13:37 -07:00
|
|
|
final class AttachmentsTable: DatabaseRelatedObjectsTable {
|
2017-07-16 19:36:38 -07:00
|
|
|
|
2017-07-29 12:08:10 -07:00
|
|
|
let name: String
|
2017-08-20 17:46:15 -07:00
|
|
|
let databaseIDKey = DatabaseKey.attachmentID
|
2017-09-12 21:47:04 -07:00
|
|
|
var cache = DatabaseObjectCache()
|
2017-07-29 12:13:38 -07:00
|
|
|
|
2017-08-20 15:56:58 -07:00
|
|
|
init(name: String) {
|
2017-07-29 12:08:10 -07:00
|
|
|
|
|
|
|
self.name = name
|
|
|
|
}
|
2017-07-16 20:51:08 -07:00
|
|
|
|
2017-09-12 21:19:45 -07:00
|
|
|
// MARK: DatabaseRelatedObjectsTable
|
|
|
|
|
2017-08-20 17:46:15 -07:00
|
|
|
func objectWithRow(_ row: FMResultSet) -> DatabaseObject? {
|
2017-09-16 13:10:03 -07:00
|
|
|
|
|
|
|
if let attachment = Attachment(row: row) {
|
2017-08-20 22:43:46 -07:00
|
|
|
return attachment as DatabaseObject
|
|
|
|
}
|
|
|
|
return nil
|
|
|
|
}
|
2017-07-16 19:36:38 -07:00
|
|
|
}
|
2017-09-12 21:19:45 -07:00
|
|
|
|